QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#749827 | #9746. 平方根 | ZhangYG | WA | 0ms | 3764kb | C++14 | 536b | 2024-11-15 10:43:23 | 2024-11-15 10:43:24 |
Judging History
answer
#include<bits/stdc++.h>
#include <iostream>
#include <algorithm>
#define ll long long
#define ld long double
using namespace std;
string str;
int len,ct;
ld ans;
int main()
{
cin >> str;
str = str + '0';
len = str.length();
for(int i = 0 ; i < len ; i++)
{
if(str[i] == '0' && ct != 0)
{
if(ct % 2 == 0)
{
ans = ans + sqrt(2) + ct / 2 - 1;
ct = 0;
}
else
{
ans = ans + (ct + 1) / 2;
ct = 0;
}
}
if(str[i] == '1') ct++;
}
cout << ans;
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3764kb
input:
1100110111
output:
4.82843
result:
wrong answer 1st numbers differ - expected: '4.8284271', found: '4.8284300', error = '0.0000006'