Created
October 9, 2019 07:44
-
-
Save surinoel/9567ce823dfa05b075c18d147269aa6d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
int main(void) { | |
ios_base::sync_with_stdio(false); | |
cin.tie(nullptr); | |
for (int i = 1; ; i++) { | |
int n, m, k; | |
cin >> n >> m >> k; | |
if (n == 0 && m == 0 && k == 0) { | |
break; | |
} | |
long long ans = 0; | |
int d1 = k / m; | |
int d2 = k % m; | |
ans += d1 * n; | |
if (d2 >= n) { | |
ans += n; | |
} | |
else { | |
ans += d2; | |
} | |
cout << "Case " << i << ": " << ans << '\n'; | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment