UVA 10922 - 2 the 9s Shipu Ahamed - 01 Sep 2020 Problem PDFSolution:/************************************* ******** Team : BUBT_HIDDEN ********** ************************************** *********** Shipu Ahamed ************* *************************************/ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define ll long long #define sc scanf #define pf printf #define pi 2*acos(0.0) #define ft first #define se second #define r(input) freopen("input.txt","r",stdin) #define w(output) freopen("output.txt","w",stdout) #define maxall(v) *max_element(v.begin(),v.end()) #define minall(v) *min_element(v.begin(),v.end()) #define sort(v) sort(v.begin(),v.end()) #define un(v) sort(v), v.erase(unique(v.begin(),v.end()),v.end()) #define cover(a,d) memset(a,d,sizeof(a)) using namespace std; int main() { char s[1005]; while(sc("%s",s)) { int l=strlen(s); if(strcmp(s,"0")==0) break; int sum=0; for(int i=0;i9) { sum=0; c++; while(d>0) { sum+=(d%10); d/=10; } //pf("%d\n",sum); d=sum; } pf("%s is a multiple of 9 and has 9-degree %d.\n",s,c); } } return 0; } https://github.com/Shipu/OnlineJudgeProblemSolutionWithCPlusPlus/tree/master/uva/10922/10922.cpp