QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#760862 | #9746. 平方根 | chensunyishuo | WA | 0ms | 3756kb | C++11 | 504b | 2024-11-18 19:51:20 | 2024-11-18 19:51:23 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main() {
ios::sync_with_stdio(false);
char x;
string s;
cin >> s;
s += '0';
int cnt = 0;
double ans = 0;
for (size_t i = 0; i < s.size(); i++) {
if (s[i] == '1') {
cnt++;
} else {
if (cnt == 0) {
continue;
}
if (cnt % 2 == 0) {
ans += (cnt / 2 - 1);
ans += sqrt(2);
} else {
ans += (cnt / 2 + 1);
}
cnt = 0;
}
}
cout << ans << endl;
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3756kb
input:
1100110111
output:
4.82843
result:
wrong answer 1st numbers differ - expected: '4.8284271', found: '4.8284300', error = '0.0000006'