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 1796. Amusement Park

WA1 ???
Posted by Hi4ko 2 Dec 2011 20:42
why is it so?

#include <iostream>
#include <cmath>
using namespace std;
int main()
{
    int value[]={ 10, 50, 100, 500, 1000, 5000 };
    int num[5],sum=0;
    int price;
    for(int i=0;i<6;i++)
    {
        cin>>num[i];
        sum+=num[i]*value[i];
    }
    cin>>price;
int i=0;
while(num[i]==0)
++i;
int lol=0,lol1=0;
while(lol*price<=sum-value[i])
    ++lol;
int j=0;
int k=0;
while((lol+k)*price<=sum)
{
    ++lol1;
    ++k;
}
cout<<lol1<<endl;
while((lol+j)*price<=sum)
{
    cout<<lol+j<<" ";
    ++j;
}
}
Re: WA1 ???
Posted by VasiAntonuk 2 Aug 2012 16:04
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
    int value[]={ 10, 50, 100, 500, 1000, 5000 };
    int num[5],sum=0;
    int price;
    for(int i=0;i<6;i++)
    {
        cin>>num[i];
        sum+=num[i]*value[i];
    }
    cin>>price;
int i=0;
while(num[i]==0)
++i;
int lol=0,lol1=0;
while(lol*price<=sum-value[i])
    ++lol;
int j=0;
int k=0;
while((lol+k)*price<=sum)
{
    ++lol1;
    ++k;
}
cout<<lol1<<endl;
while( i < lol1 )
    {
        cout << lol + j << " ";
        j++;
        i++;
    }
    cout << lol + j << endl;
}