日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 >

九余定理(hdu1013)

發布時間:2025/3/15 21 豆豆
生活随笔 收集整理的這篇文章主要介紹了 九余定理(hdu1013) 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

九余數定理

一個數對九取余后的結果稱為九余數。

一個數的各位數字之和想加后得到的<10的數字稱為這個數的九余數(如果相加結果大于9,則繼續各位相加)

Digital Roots

Time Limit: 2000/1000 MS (Java/Others)????Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 87400????Accepted Submission(s): 27256


Problem Description The digital root of a positive integer is found by summing the digits of the integer. If the resulting value is a single digit then that digit is the digital root. If the resulting value contains two or more digits, those digits are summed and the process is repeated. This is continued as long as necessary to obtain a single digit.

For example, consider the positive integer 24. Adding the 2 and the 4 yields a value of 6. Since 6 is a single digit, 6 is the digital root of 24. Now consider the positive integer 39. Adding the 3 and the 9 yields 12. Since 12 is not a single digit, the process must be repeated. Adding the 1 and the 2 yeilds 3, a single digit and also the digital root of 39.

Input The input file will contain a list of positive integers, one per line. The end of the input will be indicated by an integer value of zero.

Output For each integer in the input, output its digital root on a separate line of the output.

Sample Input 24 39 0
Sample Output 6 3
Source Greater New York 2000
#include<stdio.h> #include<string.h> int main() { char num[1000]; int len,sum,i; while(scanf("%s",&num)!=EOF)//這里為什么要字符串輸入呢?原因是因為有一個測試數據很大,int類型肯定過不了,所以在這坑點我wa好幾次{ len=strlen(num); if(len==1 && num[0]=='0') return 0; for(sum=0,i=0;i<len;i++) { sum=sum+num[i]-'0'; } printf("%d\n",sum%9?sum%9:9); } return 0; }

總結

以上是生活随笔為你收集整理的九余定理(hdu1013)的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。

主站蜘蛛池模板: 先锋影音久久 | 国产视频一区二区三区在线 | 国产精品12页 | 久久影院中文字幕 | 欧美第一页草草影院 | 久久久久国产精品人妻 | 免费黄色资源 | 黄色在线视频播放 | 亚洲精品乱码久久久久 | 中文字幕人妻一区二区在线视频 | 欧美一区二区三区久久久 | 日本黄色不卡视频 | 视频免费1区二区三区 | 91亚洲高清| 精品视频大全 | 成人精品一区二区三区视频 | 国产夫妻性生活视频 | 久久666| 亚洲日日干 | 国产精品--色哟哟 | 国产日韩欧美精品在线观看 | 三级成人在线 | 少妇一级淫免费放 | 福利网址在线 | 亚洲色图 一区二区 | 欧美日日日 | 国产精品日韩专区 | 中国女人一级一次看片 | 亚洲av色区一区二区三区 | 亚洲一区中文 | 欧美激情网址 | 成人毛片在线精品国产 | 女生毛片 | 国产专区在线播放 | 女人脱裤子让男人捅 | 成人精品久久久午夜福利 | 欧美日韩国 | 蜜臀久久精品久久久用户群体 | 国产区免费观看 | 成人一区二区电影 | 亚洲综合激情五月久久 | 无码精品黑人一区二区三区 | 97伊人超碰 | 骚av在线| 午夜在线视频免费观看 | www成人网| 黄色一级录像片 | 99草视频 | 亚洲精品字幕 | cekc老妇女cea0| 天堂在线中文在线 | 欧美乱妇狂野欧美在线视频 | 国产精品久久在线 | 成人免费在线视频观看 | 婷婷亚洲天堂 | 精品久久中文 | ww成人| 国产精品成人免费精品自在线观看 | av美女在线| 亚洲一级av毛片 | 冲田杏梨一区二区三区 | 污黄网站在线观看 | 在线观看免费福利 | 日韩美女视频 | 天天爽夜夜春 | 精品欧美一区二区久久久 | 激情五月婷婷综合 | 黄色高清视频在线观看 | 欧美日韩视频一区二区三区 | 女同性做爰全过程 | 另类ts人妖一区二区三区 | 992tv在线成人免费观看 | 国产日韩精品视频 | 麻豆成人在线视频 | 久久激情免费视频 | 夫妻精品 | 久久久久久久久久久久久国产 | 成年人av在线播放 | 日韩精品久久久久久久酒店 | 野花中文免费观看6 | 久草视频在线资源站 | 秋霞福利网| 欧美三级视频在线观看 | 成人女同av免费观看 | 国产又大又黑又粗免费视频 | 国产一级特黄 | 亚洲熟女乱综合一区二区三区 | www天天干 | 一本色道久久hezyo无码 | 日本男女啪啪 | 日韩美女三级 | 怡红院一区二区三区 | 中文高清av | 99re这里只有精品在线观看 | av瑟瑟| 日韩欧美国产一区二区三区在线观看 | 成年人爱爱视频 | 国产白袜脚足j棉袜在线观看 | 亚洲一区二区色 |