提交时间:2025-07-10 16:27:45

运行 ID: 330662

#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; }