Submission #5875

#TimeUsernameProblemLanguageResultExecution timeMemory
5875baneling100새로운 달력 (GCJ12KOR_calendar)C++98
25 / 25
0 ms1088 KiB
#include <stdio.h> long long t, month, day, week, a[101], len, sum, ans, n; void input(void) { scanf("%lld %lld %lld",&month,&day,&week); len=sum=ans=0; } void process(void) { long long i, x=day; while(1) { a[++len]=(x+week-1)/week; x+=(day%week); if(x>=day+week) x-=week; if(x==day) break; } for(i=1 ; i<=len ; i++) sum+=a[i]; ans+=sum*(month/len); for(i=1 ; i<=month%len ; i++) ans+=a[i]; } void output(void) { printf("Case #%lld: %lld\n",n,ans); } int main(void) { long long i; scanf("%lld",&t); for(i=1 ; i<=t ; i++) { n=i; input(); process(); output(); } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...