Skip to content

Instantly share code, notes, and snippets.

@seong-min-s
Last active August 28, 2019 03:31
Show Gist options
  • Save seong-min-s/21b052699eae674abb0e1a15671aef8d to your computer and use it in GitHub Desktop.
Save seong-min-s/21b052699eae674abb0e1a15671aef8d to your computer and use it in GitHub Desktop.
백준 2839번 설탕배달
#include<iostream>
using namespace std;
int main(void)
{
int n, p, q, r;
cin >> n;
p = n / 5;
q = n % 5;
r = q % 3;
while (r != 0)
{
p--;
q += 5;
r = q % 3;
}
r = (p < 0) ? -1 : p + q / 3;
cout << r;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment