#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <math.h>
#include <string>
#include <string.h>
#include <vector>
using namespace std;
//1106
int n;
int cnt(int n){
int sum=0;
while(n){
sum+=n%10;
n/=10;
}
return sum;
}
int main(){
while(scanf("%d",&n)!=EOF){
if(n==0) break;
else
printf("%d %d\n",cnt(n),cnt(n*n));
}
return 0;
}
/**************************************************************
Problem: 1106
User: cust123
Language: C++
Result: Accepted
Time:0 ms
Memory:1520 kb
****************************************************************/
题目1106:数字之和
最新推荐文章于 2021-06-03 23:30:33 发布