LibreOJ #6. Guess Number
二次联通门 : LibreOJ #6. Guess Number
/* LibreOJ #6. Guess Number 交互题初体验 用了二分判定 感觉不错 */ #include "interaction.h" #define Max 1000010 inline int solve(int i) { register int l = 0, r = Max, Mid; int res; for (; l <= r; ) { Mid = l + r >> 1; if (guess(i, Mid) >= 0) { res = Mid; r = Mid - 1; } else l = Mid + 1; } return res; } int Main () { int N = get_num(); std :: vector<int> a(N); for (int i = 0; i < N; i++) a[i] = solve(i); submit(a); } int ZlycerQan = Main (); int main (int argc, char *argv[]) {;}
myj 吊打我Orz,xxy 捆起来打我Orz,myl 文化课上天Orz, lrh 姿势水平敲高Orz, hkd 特别胖Orz%%%,cys 智商感人Orz,syl zz专业Orz,我没有学上, 我们未来一片光明