ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1025. Democracy in Danger

Everything works fine, but still doesn't accept...
Posted by Maximka 8 May 2001 11:38
Any ideas why?

#include <iostream.h>
void main()
{
long int num, subnum[101], i, j, calc=0, temp, result=0;
cin>>num;
calc=num;
for (i=0;i<num;i++) cin>>subnum[i];
if (num=1)
cout<<(subnum[0]+1)/2;
else
for (i=num-1;i>0;i--) {
        for (j=num-1;j>num-i-1;j--)
        if (subnum[j]<subnum[j-1]) {
                temp=subnum[j-1];
            subnum[j-1]=subnum[j];
            subnum[j]=temp;
        };
        calc--;
        result+=(subnum[num-i-1]+1)/2;
        if (calc*2<num) {
            cout<<result;
            break;
        }
    }
}
Obviously, you are wrong!@
Posted by Seany 6 Aug 2003 20:13
> Any ideas why?
>
> #include <iostream.h>
> void main()
> {
> long int num, subnum[101], i, j, calc=0, temp, result=0;
> cin>>num;
> calc=num;
> for (i=0;i<num;i++) cin>>subnum[i];
> if (num=1)
> cout<<(subnum[0]+1)/2;
> else
> for (i=num-1;i>0;i--) {
>         for (j=num-1;j>num-i-1;j--)
>         if (subnum[j]<subnum[j-1]) {
>                 temp=subnum[j-1];
>             subnum[j-1]=subnum[j];
>             subnum[j]=temp;
>         };
>         calc--;
>         result+=(subnum[num-i-1]+1)/2;
>         if (calc*2<num) {
>             cout<<result;
>             break;
>         }
>     }
> }
>
>