QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#749827#9746. 平方根ZhangYGWA 0ms3764kbC++14536b2024-11-15 10:43:232024-11-15 10:43:24

Judging History

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

  • [2024-11-15 10:43:24]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3764kb
  • [2024-11-15 10:43:23]
  • 提交

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'