QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#757590#9746. 平方根Jumping#Compile Error//C++14563b2024-11-17 10:58:332024-11-17 10:58:33

Judging History

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

  • [2024-11-17 10:58:33]
  • 评测
  • [2024-11-17 10:58:33]
  • 提交

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(cnt){
		if(cntt%2){
				anss+=(cntt+1)/2;
			}
			else{
				anss+=(cntt-1)/2;
				anss+=sq2;
			}cntt=0;}
	printf("%.13lf",anss);
	return 0;
}
//1100110111

详细

answer.code: In function ‘int main()’:
answer.code:21:13: error: ‘cnt’ was not declared in this scope; did you mean ‘cntt’?
   21 |         }if(cnt){
      |             ^~~
      |             cntt