Pagini recente »
Istoria paginii runda/olimpiada5
|
Cod sursă (job #664136)
|
Testare Clasa a 7-a
|
2013-03-14-test-7-8-9-10
|
Cod sursă (job #107965)
Cod sursă (job
#107965)
#include<cstdio>
using namespace std;
int norma , ratie , ziua , d , cost , tcost , kg ;
int main()
{
int SCV = 1 ;
freopen( "scv.in" , "r" , stdin ) ;
freopen( "scv.out" , "w" , stdout ) ;
scanf( "%d%d%d%d" , &cost , &tcost , &kg , &norma ) ;
if( !( cost % kg ) )
{
ratie = cost ;
ziua = cost / kg ;
}
else
{
ratie = ( cost / kg + 1 ) * kg ;
ziua = cost / kg + 1 ;
}
while( ( norma - ratie ) / SCV >= ( norma - ratie + cost - SCV * kg * tcost ) / ( SCV + 1 ) + tcost && ratie < norma )
{
++ SCV ;
ratie = ratie - cost ;
d = tcost ;
while( d && ratie < norma )
{
++ ziua ;
ratie = ratie + ( SCV - 1 ) * kg ;
d -- ;
}
while( ratie < cost )
{
++ ziua ;
ratie = ratie + SCV * kg ;
}
}
while( ratie < norma )
{
++ ziua ;
ratie = ratie + kg * SCV ;
}
printf( "%d " , ziua ) ;
///printf( "\nIisuse miluieste - ma ") ;
return 0 ;
}