본문 바로가기
백준

[2839] 설탕배달

by Jcoder 2017. 4. 21.


#include <stdio.h>
int main()
{
int three, five, n;
scanf("%d", &n);
five = n / 5;
n %= 5;
while (five >= 0)
{
if (!(n % 3))
{
three = n / 3;
n %= 3;
break;
}
five--;
n += 5;
}
printf("%d", n == 0 ? five + three : -1);
return 0;
}


'백준' 카테고리의 다른 글

[2742] 기찍 N  (0) 2018.05.14
[2741] N 찍기  (0) 2018.05.14
[2558] A+B - 2  (0) 2017.04.21
[10430] 나머지  (0) 2017.04.21
[10869] 사칙연산  (0) 2017.04.21