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 |
求大吓指点啊 为什么我一直AW。。。我都有最大 和 1加到最大和=sum(2数差绝对值)#include<stdio.h> #include<stdlib.h> int main(){ int i,k,m = 0,n,a,max1 = 0,max2 = 0,sum = 0,temp,temp1=0; while(scanf("%d",&a)!=EOF){ if(a<3000){ scanf("%d",&n); m=n; temp = n; for(i=1;i<a;i++){ scanf("%d",&n); if(max1<n) max1 = n; m = abs(m-n); sum+=m; if(max2<m) max2 =m; m = n; } if(temp>max1) max1=temp; for(k=1;k<=max2;k++){ temp1=temp1+k; } if((max1-1)==max2&&sum==temp1) printf("Jolly\n"); else printf("Not jolly\n"); } else break; max1 = 0,max2 = 0,sum = 0,temp1=0,i=0,k=0; } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator