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 in #5 Help PLEASE
Posted by Minfrommyfls 12 Jan 2012 19:07
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <cstring>
#define fi "Democracy in Danger.in"
#define fo "Democracy in Danger.out"
using namespace std;

int m;
int k;
long long sum;
int a[102];

void init_file(){
     freopen(fi, "r", stdin);
     freopen(fo, "w", stdout);
     }

void readdata(){
     scanf("%d", &k);
     for (int i = 1; i <= k; i ++){
         scanf("%d", a + i);
         }
  //       printf("%d\n", a[1]);
     }

int half(int k){
           return ((k >> 1) + 1);
    }

void work(){
     sum = 0;
     sort(a, a + k + 1);
     m = half(k);

     for (int i = 1; i <= m; i++){
         sum += half(a[m]);
         }
     printf("%d", sum);
     }

int main(){
    //init_file();
    readdata();
    work();
    return 0;
    }


My code is above.
Could u Please tell me why I had a WA in #5.
3q very much
Re: WA in #5 Help PLEASE
Posted by Vlad 17 Jan 2012 09:48
the same shit WA5