QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#757591#9746. 平方根Jumping#AC ✓16ms5320kbC++14564b2024-11-17 10:59:042024-11-17 10:59:04

Judging History

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

  • [2024-11-17 10:59:04]
  • 评测
  • 测评结果:AC
  • 用时:16ms
  • 内存:5320kb
  • [2024-11-17 10:59:04]
  • 提交

answer

#include <bits/stdc++.h>
#define int long long
double anss=0;
const double sq2=sqrtl(2);
signed main(){
	std::string s;
	std::cin>>s;
	int cntt=0;
	
	for(int i=0;i<s.length();i++){
		if(s[i]=='0'&&cntt){
			if(cntt%2){
				anss+=(cntt+1)/2;
			}
			else{
				anss+=(cntt-1)/2;
				anss+=sq2;
			}cntt=0;
		}else if(s[i]=='1')cntt++;
		//std::cout<<anss<<' '<<cntt<<'\n'; 
	}if(cntt){
		if(cntt%2){
				anss+=(cntt+1)/2;
			}
			else{
				anss+=(cntt-1)/2;
				anss+=sq2;
			}cntt=0;}
	printf("%.13lf",anss);
	return 0;
}
//1100110111

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

详细

Test #1:

score: 100
Accepted
time: 1ms
memory: 3668kb

input:

1100110111

output:

4.8284271247462

result:

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

Test #2:

score: 0
Accepted
time: 1ms
memory: 3704kb

input:

0

output:

0.0000000000000

result:

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

Test #3:

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

input:

1

output:

1.0000000000000

result:

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

Test #4:

score: 0
Accepted
time: 9ms
memory: 5320kb

input:

000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

0.0000000000000

result:

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

Test #5:

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

input:

111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

output:

500000.4142135623842

result:

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

Test #6:

score: 0
Accepted
time: 16ms
memory: 5212kb

input:

010101111011001000011101100000011110101010000110011110101010111011010011100001100000001011100111110000100101100011101101000100110100111101001100011000101000000101011101000011011001111011101101100010110110001111011001010100110011111101000010010011011101100001101001101010011011100110101001101111010101...

output:

367851.9867876115022

result:

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

Test #7:

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

input:

000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

299931.3137084990158

result:

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

Extra Test:

score: 0
Extra Test Passed