Submission #14439

#TimeUsernameProblemLanguageResultExecution timeMemory
14439gs14004새로운 달력 (GCJ12KOR_calendar)C++14
25 / 25
0 ms1084 KiB
#include <cstdio> typedef long long lint; void solve(){ lint a; int b,c; scanf("%lld %d %d",&a,&b,&c); int piv = 0; lint ret = 0; for (int i=0; i<a%c; i++) { ret += (piv + b + c - 1) / c; piv += b % c; piv %= c; // c번 반복하면 일정해짐 } lint cnt2 = a/c; lint ret2 = 0; for (int i=0; i<c; i++) { ret2 += (piv + b + c - 1) / c; piv += b % c; piv %= c; // c번 반복하면 일정해짐 } ret += ret2 * cnt2; printf("%lld\n",ret); } int main(){ int t; scanf("%d",&t); for (int i=1; i<=t; i++) { printf("Case #%d: ",i); solve(); } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...