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 |
为什么WA????????#include <stdio.h> #include<stdlib.h> int comp(const void* a,const void *b) { return *(unsigned int*)a-*(unsigned int*)b; } unsigned int a[1000010]; int main() { // char s[3][100]; int i; int n; while(scanf("%d",&n)) { for(i=0;i<n;i++) { scanf("%d",&a[i]); } // sort(a, a+n); qsort(a,n,sizeof(unsigned int),comp); /*for(i=0;i<n;i++) { cout<<a[i]<<endl; } */ int flag1=0,flag2=0; if(a[0]+a[1]<=a[n-1]) { flag1=1; } for(i=2;i<n;i++) { if(a[i-1]+a[i-2]>a[i]) { flag2=1; break; } } if(flag1==1&&flag2==1) { printf("The set is accepted.\n"); } else { printf("The set is rejected.\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