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

Why Compile error ;(
Posted by m_frankie 3 Jul 2005 23:31
In DevC++ program compile perfect; And it works; but why isn't working in here :[ Please help me...

#include<iostream>
using namespace std;
int main(){
    int k,grup[101];
        cin >> k;
        int majority = k/2+1, min[majority],sum=0;
            for(int i=0;i<k;i++)
            cin >> grup[i];
              int localMin=grup[0], indx=0,H=0;

              while(H<majority){
              for(int i=1;i<k;i++){
                      if((grup[i]<localMin)&&(grup[i]>0)){
                      localMin=grup[i];
                      indx=i;
                      }
              }
              min[H]=localMin/2+1;
              grup[indx]=-2;
              H++;
              }

for(int i=0;i<majority;i++)
        sum += min[i];

        cout << sum << endl;
}
See F.A.Q. (-)
Posted by Vladimir Yakovlev (USU) 4 Jul 2005 00:17
Re: Why Compile error ;(
Posted by taleh012 10 Apr 2007 11:58
i think there isnt any error......................
Re: Why Compile error ;(
Posted by Alias (Alexander Prudaev) 10 Apr 2007 13:35
error: expression must have a constant value

  int majority = k/2+1, min[majority],sum=0;
                            ^


int min[250];
int majority = k/2+1,sum=0;
Re: Why Compile error ;(
Posted by Desiree Sodre 3 Sep 2007 22:55


Edited by author 03.09.2007 23:00