#include "dowsing.h"
//#include <iostream>
//using namespace std;
bool B[101][101];
void FindTreasure(int N) {
int x, y, cnt=0;
for (int i=1; i<=N; i++){
if (Detect(i, i)){
++cnt;
if (cnt == 2){
y=i;
break;
}
x=i;
continue;
}
}
if (cnt > 0){
int c;
if (y != x+1) c = x+1;
else{
if (y != N) c = N;
else c = N-1;
}
if (Detect(x, c)){
Report(x, y);
return;
}
Report(y, x);
return;
}
cnt=0;
for (int i=1; i<=49; i++){
if (Detect(i, 100-i+1)){
++cnt;
x = i;
y = 100-i+1;
break;
}
}
if (cnt == 0) x = 50, y = 51;
int c;
if (y != x+1) c = x+1;
else{
if (y != N) c = N;
else c = N-1;
}
if (Detect(x, c)) Report(x, x);
else Report(y, y);
return;
}
Compilation message
dowsing.cpp: In function 'void FindTreasure(int)':
dowsing.cpp:24:4: warning: 'y' may be used uninitialized in this function [-Wmaybe-uninitialized]
if (y != N) c = N;
^~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
2 ms |
256 KB |
Execution failed because the return code was nonzero |
2 |
Halted |
0 ms |
0 KB |
- |