Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
8048 | 赖梓乐 | 各个位数之和 | C++ | Accepted | 0 MS | 264 KB | 480 | 2025-06-07 19:19:13 |
#include<iostream> // cin\cout\endl #include<cstdio> //scanf()\printf() #include<cstring> // strcpy()\strcat()\strcmp()\strlen()\memset() #include<cmath> //sqrt()\pow()\abs()\ceil()\floor()\max()\min() using namespace std; int main(){ int n,c,i=0,b=1,w; cin>>n; for(;c!=n;i++,b=b*10){ c=n%b; } for(int k=0,c=0;k<=i-1;k++){ c=n%10+c; n=n/10; //cout<<n<<endl<<c<<endl; w=c; } cout<<w; return 0; }