QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#359982 | #4991. Disc District | crsfaa# | AC ✓ | 28ms | 3736kb | C++14 | 599b | 2024-03-21 08:34:24 | 2024-03-21 08:34:25 |
Judging History
answer
#include<bits/stdc++.h>
#define Yukinoshita namespace
#define Yukino std
#define int long long
using Yukinoshita Yukino;
int read()
{
int s=0,w=1;
char ch=getchar();
while(ch<'0'||ch>'9') w=ch=='-'?-1:1,ch=getchar();
while(ch>='0'&&ch<='9') s=s*10+ch-'0',ch=getchar();
return s*w;
}
char s[100005];
int dis(int x,int y)
{
return x*x+y*y;
}
/*
16+49
1+64
*/
signed main()
{
int r=read(),i,j,mn=1e18,x,y;
for(i=0;i<=r+1;i++)
{
int w=0;
for(j=1<<20;j;j>>=1)
w+=(dis(i,w+j)<=r*r)*j;
if(dis(i,w+1)<mn)
mn=dis(i,w+1),x=i,y=w+1;
}
cout<<x<<' '<<y;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3716kb
input:
1
output:
1 1
result:
ok
Test #2:
score: 0
Accepted
time: 0ms
memory: 3592kb
input:
8
output:
1 8
result:
ok
Test #3:
score: 0
Accepted
time: 3ms
memory: 3652kb
input:
90210
output:
1 90210
result:
ok
Test #4:
score: 0
Accepted
time: 1ms
memory: 3708kb
input:
11211
output:
1 11211
result:
ok
Test #5:
score: 0
Accepted
time: 15ms
memory: 3736kb
input:
524288
output:
1 524288
result:
ok
Test #6:
score: 0
Accepted
time: 0ms
memory: 3600kb
input:
99
output:
1 99
result:
ok
Test #7:
score: 0
Accepted
time: 28ms
memory: 3648kb
input:
1000000
output:
1 1000000
result:
ok
Test #8:
score: 0
Accepted
time: 28ms
memory: 3652kb
input:
999999
output:
1 999999
result:
ok
Test #9:
score: 0
Accepted
time: 6ms
memory: 3652kb
input:
192837
output:
1 192837
result:
ok
Test #10:
score: 0
Accepted
time: 28ms
memory: 3600kb
input:
999997
output:
1 999997
result:
ok
Test #11:
score: 0
Accepted
time: 12ms
memory: 3712kb
input:
424242
output:
1 424242
result:
ok
Test #12:
score: 0
Accepted
time: 5ms
memory: 3668kb
input:
171407
output:
1 171407
result:
ok
Test #13:
score: 0
Accepted
time: 17ms
memory: 3708kb
input:
605579
output:
1 605579
result:
ok
Test #14:
score: 0
Accepted
time: 27ms
memory: 3724kb
input:
971813
output:
1 971813
result:
ok
Test #15:
score: 0
Accepted
time: 4ms
memory: 3592kb
input:
131198
output:
1 131198
result:
ok
Test #16:
score: 0
Accepted
time: 3ms
memory: 3648kb
input:
80069
output:
1 80069
result:
ok
Test #17:
score: 0
Accepted
time: 23ms
memory: 3712kb
input:
838980
output:
1 838980
result:
ok
Test #18:
score: 0
Accepted
time: 11ms
memory: 3668kb
input:
394053
output:
1 394053
result:
ok
Test #19:
score: 0
Accepted
time: 27ms
memory: 3640kb
input:
977835
output:
1 977835
result:
ok
Test #20:
score: 0
Accepted
time: 17ms
memory: 3660kb
input:
616143
output:
1 616143
result:
ok
Test #21:
score: 0
Accepted
time: 13ms
memory: 3640kb
input:
469961
output:
1 469961
result:
ok
Test #22:
score: 0
Accepted
time: 6ms
memory: 3668kb
input:
216504
output:
1 216504
result:
ok
Test #23:
score: 0
Accepted
time: 3ms
memory: 3668kb
input:
81537
output:
1 81537
result:
ok