-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy path1136.cpp
More file actions
45 lines (37 loc) · 973 Bytes
/
1136.cpp
File metadata and controls
45 lines (37 loc) · 973 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
//Questão 1136 - Bingo! - URI Online Judge
#include <iostream>
#include <cmath>
using namespace std;
int main(){
int n, b, i, j, k;
bool flag;
while(true){
cin >> n >> b;
if(!n && !b)
break;
int bolas[b];
for(i = 0; i < b; i++)
cin >> bolas[i];
for(k = 0; k <= n; k++){
flag = false;
for(i = 0; i < b; i++){
//Flag indicará se o número foi anunciado ou não
for(j = 0; j < b; j++){
if(abs(bolas[i] - bolas[j]) == k){
flag = true;
break;
}
}
if(flag)
break;
}
if(!flag)
break;
}
if(flag)
cout << "Y" << endl;
else
cout << "N" << endl;
}
return 0;
}