QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#749831#9746. 平方根ZhangYGAC ✓13ms5372kbC++14546b2024-11-15 10:45:132024-11-15 10:45:15

Judging History

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

  • [2024-11-15 10:45:15]
  • 评测
  • 测评结果:AC
  • 用时:13ms
  • 内存:5372kb
  • [2024-11-15 10:45:13]
  • 提交

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++;
	}
	printf("%.18llf",ans);
	return 0;
}

这程序好像有点Bug,我给组数据试试?

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3708kb

input:

1100110111

output:

4.828427124746190291

result:

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

Test #2:

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

input:

0

output:

0.000000000000000000

result:

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

Test #3:

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

input:

1

output:

1.000000000000000000

result:

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

Test #4:

score: 0
Accepted
time: 10ms
memory: 5260kb

input:

000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

0.000000000000000000

result:

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

Test #5:

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

input:

111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

output:

500000.414213562373106470

result:

ok found '500000.414213562', expected '500000.414213562', error '0.000000000'

Test #6:

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

input:

010101111011001000011101100000011110101010000110011110101010111011010011100001100000001011100111110000100101100011101101000100110100111101001100011000101000000101011101000011011001111011101101100010110110001111011001010100110011111101000010010011011101100001101001101010011011100110101001101111010101...

output:

367851.986787086145000103

result:

ok found '367851.986787086', expected '367851.986787086', error '0.000000000'

Test #7:

score: 0
Accepted
time: 10ms
memory: 5224kb

input:

000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

299931.313708498984738071

result:

ok found '299931.313708499', expected '299931.313708499', error '0.000000000'

Extra Test:

score: 0
Extra Test Passed