| ||||||||||
| 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:为什么说我超出outputIn Reply To:为什么说我超出output Posted by:9990123 at 2006-07-27 19:43:41 > #include <string>
> #include <algorithm>
> #include <iostream>
> using namespace std;
> int main()
> {
> char data[70];
> while (scanf("%s",data))
> {
> int no = strlen(data);
> int flag =0;
> int i,temp,num=0;
> for (i = 0;i<no;i++)
> {
> if (data[i] =='0')
> num++;
> }
> if (num == no)
> {
> printf("%s is cyclic\n",data);
> memset(data,0,sizeof(data));
> continue;
> }
> num =0;
> for (i=no-1;i>=0;i--)
> {
> temp = (data[i] -'0')* (no+1) + flag;
> flag = temp /10;
> temp = temp %10;
> if (temp == 9)
> {
> num++;
> }
> }
> if (num == no) printf("%s is cyclic\n",data);
> else printf("%s is not cyclic\n",data);
> memset(data,0,sizeof(data));
> }
> }
> 就算错也最多时wa,怎么会output错呢?
>
>
>
>
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator