Submission #13747

# Submission time Handle Problem Language Result Execution time Memory
13747 2015-03-30T20:37:48 Z veckal 새로운 달력 (GCJ12KOR_calendar) C++14
25 / 25
0 ms 1084 KB
#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 time Memory Grader output
1 Correct 0 ms 1084 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1084 KB Output is correct