CCF-201709-1打酱油
原题:
分析:钱大于50就买5瓶送2瓶,钱大于30就买3瓶送1瓶,小于30就一瓶一瓶的买。
代码:
#include <bits/stdc++.h>
using namespace std;
int main()
{
int N;
scanf("%d",&N);
int res=0;
while(N>0)
{
if(N>=50)
{
res=res+7;
N=N-50;
}
if(N>=30&&N<50)
{
res=res+4;
N=N-30;
}
if(N>0&&N<30)
{
res=res+N/10;
N=0;
}
}
printf("%d",res);
return 0;
}