Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
8047 余立涵 各个位数之和 C++ Wrong Answer 0 MS 252 KB 326 2025-06-07 19:16:13

Tests(1/5):


Code:

#include<bits/stdc++.h> using namespace std; int main(){ int n=10; int s=0; int x; cin>>x; int o; if(s==0){ o=x; s=o%10; } while(o!=0){ o=x; o=o/n; o=o%10; s=s+o; n=n*10; } cout<<s<<endl; return 0; }


Run Info:

------Input------
10111
------Answer-----
4
------Your output-----
3