結果

問題 No.836 じょうよ
コンテスト
ユーザー iiljj
提出日時 2020-09-25 01:49:26
言語 C(gnu17)
(gcc 15.2.0)
コンパイル:
gcc-15 -O2 -std=gnu17 -Wno-error=implicit-function-declaration -Wno-error=implicit-int -Wno-error=incompatible-pointer-types -Wno-error=int-conversion -DONLINE_JUDGE -o a.out _filename_ -lm
実行:
./a.out
結果
AC  
実行時間 11 ms / 1,000 ms
コード長 643 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 138 ms
コンパイル使用メモリ 38,116 KB
最終ジャッジ日時 2026-02-22 06:08:59
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 41
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <stdio.h>
#define ll long long

int main() {
    ll l, r, n, ret, quo, rem;
    scanf("%lld %lld %lld", &l, &r, &n);

    for (ll remainder = 0; remainder < n; ++remainder) {
        quo = r / n;
        rem = r - quo * n;
        if (rem < 0) {
            rem += n;
            quo -= 1;
        }
        ret = (remainder <= rem) ? quo + 1 : quo;

        if (l > 0) {
            quo = (l - 1) / n;
            rem = l - 1 - quo * n;
            if (rem < 0) {
                rem += n;
                quo -= 1;
            }
            ret -= (remainder <= rem) ? quo + 1 : quo;
        }
        printf("%lld\n", ret);
    }
}
0