QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#777520#9746. 平方根ERin_cy#WA 13ms5280kbC++20595b2024-11-24 02:50:282024-11-24 02:50:29

Judging History

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

  • [2024-11-24 02:50:29]
  • 评测
  • 测评结果:WA
  • 用时:13ms
  • 内存:5280kb
  • [2024-11-24 02:50:28]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
void solve(){
   string str;
   cin >> str;
   vector<int>ve;
   int len = 0;
   for(int i = 0;i<str.size();i++){
        if(str[i] == '1'){
            len++;
        }
        else{
            if(len != 0)ve.push_back(len);
            len = 0;
        }
   }
   if(len != 0)ve.push_back(len);
   double ans = 0;
   for(auto x : ve){
        ans += (x / 3) * 2;
        ans += sqrt(x%3);
   }
   printf("%.9lf",ans);
}
int main(){
    int t;
    t = 1;
    while(t--){
        solve();
    }
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3784kb

input:

1100110111

output:

4.828427125

result:

ok found '4.828427125', expected '4.828427125', error '0.000000000'

Test #2:

score: 0
Accepted
time: 1ms
memory: 3984kb

input:

0

output:

0.000000000

result:

ok found '0.000000000', expected '0.000000000', error '-0.000000000'

Test #3:

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

input:

1

output:

1.000000000

result:

ok found '1.000000000', expected '1.000000000', error '0.000000000'

Test #4:

score: 0
Accepted
time: 13ms
memory: 5232kb

input:

000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

0.000000000

result:

ok found '0.000000000', expected '0.000000000', error '-0.000000000'

Test #5:

score: -100
Wrong Answer
time: 8ms
memory: 5280kb

input:

111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

output:

666667.000000000

result:

wrong answer 1st numbers differ - expected: '500000.4142136', found: '666667.0000000', error = '0.3333329'