得分(Score,ACMICPC Seoul 2005,UVa1585)

tech2022-12-06  94

#include<iostream> #include<cstring> #include<string> using namespace std; int main(){ string s; cin>>s; int count = 0; int ans = 0; int j,i; for(i = 0;i < s.length() ;i++){ if(s[i] == 'X'){ count = 0; }else{ for( j = i;s[j] == 'O';j++){ count++; ans += count; } j--; i = j; } } cout<<ans<<endl; return 0; }
最新回复(0)