QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#841694 | #9746. 平方根 | liujunyi123 | WA | 5ms | 4932kb | C++14 | 481b | 2025-01-03 22:38:45 | 2025-01-03 22:38:45 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
const int N=1e6+5;;
char s[N];
int n;
double solve(int n){
double sum=0;
for(int i=1;i<=(n+1)/2;i++){
int res=n-(i-1);
int x=res/i,r=res%i;
double ans=(i-(r!=0))*sqrt(x)+sqrt(r);
sum=max(sum,ans);
}
return sum;
}
int main(){
scanf("%s",s+1);
n=strlen(s+1);
int p=0;
double sum=0;
for(int i=1;i<=n;i++)if(s[i]=='1')p++;else sum+=solve(p),p=0;
sum+=solve(p);
printf("%.12lf",sum);
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3908kb
input:
1100110111
output:
4.828427124746
result:
ok found '4.828427125', expected '4.828427125', error '0.000000000'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3916kb
input:
0
output:
0.000000000000
result:
ok found '0.000000000', expected '0.000000000', error '-0.000000000'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3900kb
input:
1
output:
1.000000000000
result:
ok found '1.000000000', expected '1.000000000', error '0.000000000'
Test #4:
score: 0
Accepted
time: 2ms
memory: 4836kb
input:
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
output:
0.000000000000
result:
ok found '0.000000000', expected '0.000000000', error '-0.000000000'
Test #5:
score: -100
Wrong Answer
time: 5ms
memory: 4932kb
input:
111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...
output:
500000.000000000000
result:
wrong answer 1st numbers differ - expected: '500000.4142136', found: '500000.0000000', error = '0.0000008'