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

WA on #5,Why?
Posted by pyh119 10 Dec 2006 20:26
#include "stdio.h"

int main ()
{
    long n,total;
    long i,j;
    long zz;
    long a[1000];

    scanf ("%ld",&n);
    for (i=1;i<=n;)
        {
        scanf ("%ld",&a[i]);
        if (a[i]%2!=0) i++;
        }
    for (i=1;i<=n;i++)
        for (j=i+1;j<=n;j++)
            if (a[i]>a[j]) {
                           zz=a[j];
                           a[i]=a[j];
                           a[j]=zz;
                           }
    total=0;
    for (i=1;i<=n/2+1;i++)
        total=total+a[i]/2+1;
    printf ("%ld",total);
    return (0);
}
Re: WA on #5,Why?
Posted by Nechaev Ilya (Rybinsk SAAT) 11 Dec 2006 19:17
zz=a[i]; !!!

Edited by author 11.12.2006 19:25
Re: WA on #5,Why?
Posted by pyh119 12 Dec 2006 17:11
Thank you very much,I've just had a silly wrong!