| ||||||||||
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:请教。如何判断每行输入结束?In Reply To:Re:请教。如何判断每行输入结束? Posted by:huicpc21 at 2005-08-16 18:52:48 我觉得我的没什么问题啊 为什么不行啊 #include<stdio.h> #include<math.h> #define MAX 3000 void main(){ int n,i,a[MAX],b[MAX]={0},mid; while(scanf("%d",&n)!=EOF){ int m=1; for(i=1;i<=n;i++) scanf("%d",&a[i]); for(i=2;i<=n;i++){ mid=abs(a[i]-a[i-1]); if(mid>n-1||mid==0){ m=0;break; } else if(b[mid]==0){ b[mid]=1; } else if(b[mid]){ m=0;break; } } if(m) printf("Jolly\n"); else printf("Not jolly\n"); for(i=0;i<n;i++) b[i]=0; } } > 题目是先读入n的,然后后面有n个数呀 > 所以判断的方法只要看读到的n是否为EOF即可 Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator