結果

問題 No.1899 L1 Cafe
ユーザー colognecologne
提出日時 2022-04-08 21:38:56
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 61 ms / 2,000 ms
コード長 443 bytes
コンパイル時間 3,307 ms
コンパイル使用メモリ 249,096 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-11-28 12:16:09
合計ジャッジ時間 6,113 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 12
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/math>
using namespace std;

int main()
{
    int T;
    scanf("%d", &T);
    while (T--)
    {
        long N, A, B;
        scanf("%ld%ld%ld", &N, &A, &B);
        long ans = 0;
        ans += N * (N / A) - A * (N / A) * (N / A + 1) / 2;
        ans += N * (N / B) - B * (N / B) * (N / B + 1) / 2;
        if(N >= A) ans -= atcoder::floor_sum(N / A, B, A, N%A);
        printf("%ld\n", ans);
    }
}
0