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:一个简单的代码 Posted by:fuliang at 2009-05-03 23:46:19 为什么我的就WA呢 #include<stdio.h> #include<math.h> #include<string.h> int main() { int n,i,j,h[3005],a[3005]; while(scanf("%d",&n)!=EOF) { for(i=0;i<n;i++) scanf("%d",&a[i]); memset(h,0,3005); for(i=1;i<n;i++) { j=a[i]-a[i-1]; if(j<0) j=-j; h[j]=1; } for(i=1;i<n;i++) if(h[i]==0) { printf("Not jolly\n"); break; } if(i==n) printf("Jolly\n"); } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator