//#include "treasure.h"
#include"header.h"
int result[10009][4];
int rl;
void dfs(int remain, int si, int ei, int sj, int ej) {
if (remain == (ei - si + 1) * (ej - sj + 1)) {
result[rl][0] = si;
result[rl][1] = ei;
result[rl][2] = sj;
result[rl][3] = ej;
rl++;
return;
}
if (remain == 0) {
return;
}
if (ei - si > ej - sj) {
int mi = (si + ei) / 2;
int cur = countTreasure(si + 1, sj + 1, mi + 1, ej + 1);
dfs(cur, si, mi, sj, ej);
dfs(remain - cur, mi + 1, ei, sj, ej);
}
else {
int mj = (sj + ej) / 2;
int cur = countTreasure(si + 1, sj + 1, ei + 1, mj + 1);
dfs(cur, si, ei, sj, mj);
dfs(remain - cur, si, ei, mj+1, ej);
}
}
void findTreasure(int N) {
int cnt = countTreasure(1, 1, N, N);
if (cnt == 0)return;
else {
rl = 0;
dfs(cnt, 0, N - 1, 0, N - 1);
while (rl--) {
for (int i = result[rl][0]; i <= result[rl][1]; i++) {
for (int j = result[rl][2]; j <= result[rl][3]; j++) {
Report(i + 1, j + 1);
}
}
}
}
}
Compilation message
treasure.cpp:2:9: fatal error: header.h: No such file or directory
#include"header.h"
^~~~~~~~~~
compilation terminated.