- 对齐输出
输出正整数各位数字的平方和
- 2024-1-16 16:02:05 @
#include <bits/stdc++.h> using namespace std; int main() { int a=1234,s=0; cin>>a>>s; scanf ("%d",&a);
s=0;
while (a!=0)
{
s=s+(a%10)*(a%10);
a=a/10;
} cout<<s<<endl; return 0; }
0 comments
No comments so far...
Information
- ID
- 849
- Time
- 1000ms
- Memory
- 256MiB
- Difficulty
- 6
- Tags
- # Submissions
- 202
- Accepted
- 42
- Uploaded By