QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#293641 | #7601. IQ Test | ship2077 | WA | 0ms | 3856kb | C++14 | 402b | 2023-12-29 15:13:48 | 2023-12-29 15:13:48 |
Judging History
answer
#include<bits/stdc++.h>
#define int long long
using namespace std;
int n;map<int,bool>f;
vector<pair<int,int>>ans;
void solve(int n){
if (f[n]) return ;
int x=ceil(sqrt(n));
ans.push_back({x,x*x-n});f[n]=1;
solve(x);solve(x*x-n);
}
signed main(){
f[0]=f[1]=f[2]=1;
cin>>n;solve(n);
reverse(ans.begin(),ans.end());
for (auto [x,y]:ans)
printf("%lld %lld\n",x,y);
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3684kb
input:
5
output:
2 0 2 1 3 4
result:
ok Successful, 3 queries
Test #2:
score: 0
Accepted
time: 0ms
memory: 3856kb
input:
7
output:
2 1 3 2
result:
ok Successful, 2 queries
Test #3:
score: 0
Accepted
time: 0ms
memory: 3600kb
input:
1
output:
result:
ok Successful, 0 queries
Test #4:
score: -100
Wrong Answer
time: 0ms
memory: 3692kb
input:
29
output:
3 2 2 1 3 3 6 7
result:
wrong answer a=3 and b=2 must be in S