数根
来源:互联网 发布:linux驱动移植 编辑:程序博客网 时间:2024/06/09 17:28
#include <iostream>using namespace std;int fun(int t){int k=0;while (t!=0){k+=t%10;t=t/10;}return k;}int main(){int n,i,sum=0;char a[1010];cin >> n;while (n--){sum=0;cin >> a;for (i=0;a[i]!='\0';i++){sum+=a[i]-'0';}while(sum>=10){sum=fun(sum);}cout << sum << endl;}return 0;}
0 0
- 数根
- 数根
- 数根
- 数根
- 数根
- 数根
- 数根
- 数根
- 数根
- POJ 2764:数根
- 1084: 【循环】数根
- I00026 计算数根
- NoiOpenJudge 1.13 数根
- AOJ-754 数根
- CCF NOI1035 数根
- 数
- 数
- 数
- 还是写点东西吧!
- 如何让背景半透明
- fatal: the remote end hung up unexpectedly
- Could not load the FreeMarker template named 'select'
- poj 3140 Contestants Division(树形dp)
- 数根
- Android之mainfest文件中android属性
- iOS 之core Data操作(三)
- android 通过post发送数据完成客户端的登陆模块
- ArrayList和LinkedList区别
- ArcGIS API For Flex创建比例尺ScaleBar样式
- Linux proc/%d/stat文件详解
- iOS 之MKNetWorkKit简介
- 中水处理设备:中水处理设备发展趋势剖析