제출 #1289116

#제출 시각아이디문제언어결과실행 시간메모리
1289116Isam새로운 달력 (GCJ12KOR_calendar)C++20
0 / 25
1 ms568 KiB
#include "bits/stdc++.h"
using namespace std;

#define int long long

constexpr int sz = 2e5 + 5;

int n, a, b, c, ans, k;

void solve(){
    cin >> n;
    for(int i = 1; i <= n; ++i){
        cin >> a >> b >> c;
        k = c / __gcd(b % c, c);
        ans = (a * b) / c + (a / k) * (k - 1) + a % k;
        cout << "Case #" << i << ' ' << ans << '\n';
    }
    return;
}

signed main(){
    cout.tie(0)->sync_with_stdio(0);
    cin.tie(0)->sync_with_stdio(0);
    int t = 1;
    //cin >> t;
    while(t--) solve();
    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...