Skip to content

Commit

Permalink
캠핑
Browse files Browse the repository at this point in the history
  • Loading branch information
yewon-yw authored Jul 25, 2022
1 parent 39ab935 commit ba40c7c
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions greedy_algorithm/4796.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#include <iostream>
using namespace std;

int main() {
int l, p, v, res, i = 1;
while (1) {
cin >> l >> p >> v;
if (!l && !p && !v) break;
res = v / p * l;
res += v % p > l ? l : v % p;
cout << "Case " << i++ << ": " << res << "\n";
}
}

0 comments on commit ba40c7c

Please sign in to comment.