Submission #13747

#TimeUsernameProblemLanguageResultExecution timeMemory
13747veckal새로운 달력 (GCJ12KOR_calendar)C++14
25 / 25
0 ms1084 KiB
#include <stdio.h> typedef long long ll; ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; } ll month, md, wd; int main() { int T, N; scanf("%d", &T); for (N=1; N<=T; ++N) { scanf("%lld%lld%lld", &month, &md, &wd); printf("Case #%d: ", N); printf("%lld\n", (month*md+wd-1)/wd+month-1 - (month-1)/(wd/gcd(wd,md))); } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...