#include "dowsing.h"
void chk(int c, int d) {
if (c==d) Report(c+1,d+1);
else if (Detect(c+1,d==0?(c==1?3:2):1)) Report(c+1,d+1);
else Report(d+1,c+1);
}
void rchk(int c, int d) {
if (c==d) Report(c+1,d+1);
else if (Detect(c+1,c==0?(d==1?3:2):1)) Report(c+1,c+1);
else Report(d+1,d+1);
}
void FindTreasure(int N) {
int i, c = -1, d = -1;
for (i=0;i<N;i++){
if (Detect(i+1,i+1)) {
if (c<0) c = i;
else d = i;
}
}
if (c>=0) {
chk(c,d);
return;
}
for (i=0;i<(N-1)/2;i++) {
if (Detect(i+1,N-i)) {
rchk(i,N-1-i);
return;
}
}
rchk((N-1)/2,N-1-(N-1)/2);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Correct : C = 5 |
2 |
Runtime error |
2 ms |
256 KB |
Execution failed because the return code was nonzero |
3 |
Halted |
0 ms |
0 KB |
- |