| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
Re:无意间发现简单的算法!~我是按照你的这个简单算法编的程序~为什么AC不了呢??????牛人指教下!!In Reply To:Re:无意间发现简单的算法!~我是按照你的这个简单算法编的程序~为什么AC不了呢??????牛人指教下!! Posted by:gaoxingok99 at 2009-08-10 10:01:31 > #include<stdio.h>
> #include<string.h>
> #include<stdlib.h>
>
> void main()
> {
> char a[80]={0};
> int n;
> int i,len,re,ans;
> while(scanf("%s",a)!=EOF)
> {
> len=strlen(a);
> n=atoi(a);
>
> re=n*(len+1);
> ans=9;
> for(i=1;i<len;i++)
> {
> ans=ans*10+9;
> }
> if(re==ans)
> printf("%s is cyclic\n",a);
> else
> printf("%s is not cyclic\n",a);
> }
> }
>
>
>
>
>
>
兄弟,高精度乘法,你那个atoi不行的。
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator