The below code gives SIGTSTP but I am not able to find the fault. The original question link is: https://codeforces.com/contest/102/problem/B . Please Help.
#include<bits/stdc++.h>
using namespace std;
int main()
{
int x,sum=0,count=0;
string s; cin>>s;
while(s.length()>1){
for(int i=0;i<s.length();i++){
x=s[i]-'0';
sum+=x;
}
s=std::to_string(sum);
count++;
}
cout<<count;
return 0;
}
Aucun commentaire:
Enregistrer un commentaire