QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#501403#5152. Circular Caramel Cookiegrave1011WA 0ms3944kbC++20833b2024-08-02 17:53:102024-08-02 17:53:10

Judging History

你现在查看的是最新测评结果

  • [2024-08-02 17:53:10]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3944kb
  • [2024-08-02 17:53:10]
  • 提交

answer

#include <bits/stdc++.h>
#define N 5000001
using namespace std;
int main()
{
    int n,x,y;
    cin>>n;
    int i=1;
    for(; i*i<=n; i++);
    if(i%2==1)i++;
    int sum=i*i;
    x=y=i/2;
    int cnt=1;
    int oldx=x,oldy=y;
    while(sum-(cnt>1?8:4)>n)
    {
        int t=cnt;
        oldx--;
        while(t>0&&sum-4*(t==1?1:2)>n)
        {
//            cout<<x<<' '<<y<<endl;
            sum-=4*(t==1?1:2);
            if(t==1)t-=1;
            else t-=2;
            oldx=x-1;
            oldy=y;
            x++;
            y--;

        }
        if(t<=0)
        {
            x=i/2-cnt;
            y=i/2;
            oldx=x;
            oldy=y;
        }
        cnt++;
    }
//    cout<<x<<' '<<y<<endl;
    printf("%.10lf",max(sqrt(x*x+y*y),sqrt(oldx*oldx+oldy*oldy)));
}


详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 3812kb

input:

11

output:

2.2360679775

result:

ok found '2.2360680', expected '2.2360680', error '0.0000000'

Test #2:

score: 0
Accepted
time: 0ms
memory: 3876kb

input:

59

output:

5.0000000000

result:

ok found '5.0000000', expected '5.0000000', error '0.0000000'

Test #3:

score: 0
Accepted
time: 0ms
memory: 3908kb

input:

1

output:

1.4142135624

result:

ok found '1.4142136', expected '1.4142136', error '0.0000000'

Test #4:

score: 0
Accepted
time: 0ms
memory: 3924kb

input:

2

output:

1.4142135624

result:

ok found '1.4142136', expected '1.4142136', error '0.0000000'

Test #5:

score: 0
Accepted
time: 0ms
memory: 3796kb

input:

3

output:

1.4142135624

result:

ok found '1.4142136', expected '1.4142136', error '0.0000000'

Test #6:

score: 0
Accepted
time: 0ms
memory: 3944kb

input:

4

output:

2.2360679775

result:

ok found '2.2360680', expected '2.2360680', error '0.0000000'

Test #7:

score: -100
Wrong Answer
time: 0ms
memory: 3860kb

input:

1000000000

output:

22223.2399078082

result:

wrong answer 1st numbers differ - expected: '17841.8813190', found: '22223.2399078', error = '0.2455660'