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 1005. Stone Pile

What is WRONG
Posted by Otaku 15 Mar 2009 14:46
#include <iostream>
using namespace std;
int main()
{
int n,d;
int group=0,ves=0;
int *kamen = new int[1000];
cin>>n;
for (int i=0;i<n;i++)
{
cin>>kamen [i];
group += kamen[i];
}
ves = group/2;
for (int i=0;i<n;i++){
for(int j=0;j<n;j++){
if(ves>kamen[j]){
             ves-=kamen[j];
}
}
}

d= ves*2;
d+= group%2;
cout<<d-1;

system ("pause");
return 0;

}




Edited by author 15.03.2009 14:52
Re: What is WRONG
Posted by SImon 15 Mar 2009 14:54
YOU MUST DO LIKE THIS
d= ves * 2 = group%2
I had problem like this in other programm
Re: What is WRONG
Posted by Otaku 15 Mar 2009 14:56
THANKS,YOU SAVED MY LIFE