QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#760862#9746. 平方根chensunyishuoWA 0ms3756kbC++11504b2024-11-18 19:51:202024-11-18 19:51:23

Judging History

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

  • [2024-11-18 19:51:23]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3756kb
  • [2024-11-18 19:51:20]
  • 提交

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'