Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
330662 | 黄浙峰老师 | 【C5-2】数根 | C++ | 通过 | 100 | 3 MS | 252 KB | 221 | 2025-07-10 16:27:45 |
#include<bits/stdc++.h> using namespace std; int sum(int x){ int s=0; while(x>0){ s+=x%10; x=x/10; } return s; } int main(){ int n; cin>>n; while(n>9){ n=sum(n); } cout<<n; return 0; }