POJ 1047 Round and Round We Go
生活随笔
收集整理的這篇文章主要介紹了
POJ 1047 Round and Round We Go
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
http://poj.org/problem?id=1047
按照某大牛總結(jié)的一條規(guī)律,對(duì)于數(shù)N,若N為循環(huán)的則有N*(length(N)+1)=99....99, (length(N)個(gè)9),length(N)為N的位數(shù),含前導(dǎo)0。應(yīng)該還是簡(jiǎn)單的...
還有POJ是什么時(shí)候換網(wǎng)址的...= =b
#include<iostream> #include<string> using namespace std; bool fun(string str) {int n=str.length()+1;int i,up=0,temp=0;for(i=n-2;i>=0;i--){temp=(int)(str[i]-'0');if((temp*n+up)%10!=9) return false;up=(temp*n+up)/10;}return true; } int main() {string str1;while(cin>>str1){if(fun(str1)){cout<<str1<<" is cyclic"<<endl; }else{cout<<str1<<" is not cyclic"<<endl;}}return 0; }轉(zhuǎn)載于:https://www.cnblogs.com/wotata/archive/2011/03/16/1986180.html
總結(jié)
以上是生活随笔為你收集整理的POJ 1047 Round and Round We Go的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 由于检索用户的本地应用程序数据路径时出错
- 下一篇: Button的点击事件