hdu1013-Digital Roots
来源:互联网 发布:mac如何彻底关闭程序 编辑:程序博客网 时间:2024/04/28 15:04
http://acm.hdu.edu.cn/showproblem.php?pid=1013
题意:求各个数位的和,如果大于9,继续处理
#include<iostream>#include<cstdio>#include<cstring>#include<cmath>#include<algorithm>#include<bitset>#include<stdlib.h>using namespace std;int main(){char str[ 1005 ] ;int len , ans , sum ;while( ~scanf( "%s" , str ) ){if( str[ 0 ] == '0' )break ;len = strlen( str ) ;sum = 0 ;while( len-- ){sum += str[ len ] - '0' ;}while( sum > 9 ){ans = 0 ;while( sum ){ans += sum % 10 ;sum /= 10 ;}sum = ans ;}cout << sum << endl ;}return 0 ;}
- HDU1013 Digital Roots
- hdu1013 Digital Roots
- hdu1013 Digital Roots
- hdu1013(Digital Roots)
- HDU1013 Digital Roots
- hdu1013-Digital Roots
- hdu1013 Digital Roots
- hdu1013 Digital Roots
- hdu1013:Digital Roots
- hdu1013 Digital Roots 数论
- hdu1013 Digital Roots
- HDU1013 Digital Roots
- HDU1013 Digital Roots
- HDU1013 Digital Roots
- Digital Roots—HDU1013
- HDU1013 POJ1519 Digital Roots
- hdu1013 Digital Roots
- HDU1013 Digital Roots
- 动态的获取和设置ImageView的宽度和高度
- linux下的二进制工具(反编译工具)
- ios UIImageView 中的image显示部分
- mac如何共享文件
- gassion永刚
- hdu1013-Digital Roots
- 反编译APK系列之dx的使用
- c/c++数据转换方法
- 机器人II解题报告
- 天气预报插件
- 为什么调用 FragmentPagerAdapter.notifyDataSetChanged() 并不能更新其 Fragment?
- GUI.DrawTexture 绘制纹理
- ShowPopup无法弹框提示
- libnet库下载、编译、示例、文档