|
|
вернуться в форумAC prog!!!all test gives OK but WA#8 PLEASE HELP #include <iostream> #include <algorithm> using namespace std; int n; int a[30],b[30]={0}; int main(){ cin>>n; int i,j; for(i=0;i<n;i++) cin>>a[i]; sort(a,a+n); int ans=n; for (i=n;i>=0;i--){ if(b[i]==1)continue; for(j=i;j>=0;j--){ if(a[i]-a[j]==1&&b[j]!=1){ // i++; b[j]=1; ans--; } } } cout<<ans<<endl; // cin>>n; return 0; } Thanks Re: AC prog!!!all test gives OK but WA#8 PLEASE HELP If there is WA, program cant be called "AC" =) Re: AC prog!!!all test gives OK but WA#8 PLEASE HELP why? Edited by author 03.07.2007 15:36 Edited by author 01.06.2008 12:33 Re: AC prog!!!all test gives OK but WA#8 PLEASE HELP Yes [AC code is moderator] but this prog is the best.]:---} Edited by author 03.07.2007 15:41 Edited by author 01.06.2008 12:34 Edited by author 01.06.2008 12:35 |
|
|