結果

問題 No.836 じょうよ
ユーザー merom686
提出日時 2019-06-14 21:30:00
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 7 ms / 1,000 ms
コード長 616 bytes
コンパイル時間 820 ms
コンパイル使用メモリ 73,324 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-08 20:33:03
合計ジャッジ時間 2,159 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 41
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);

    ll l, r;
    cin >> l >> r;
    r++;

    int n;
    cin >> n;

    ll k = r - l;
    ll q = k / n;
    r -= q * n;
    l %= n;
    r %= n;
    for (int i = 0; i < n; i++) {
        int t = 0;
        if (l > r) {
            if (l <= i || i < r) t = 1;
        } else {
            if (l <= i && i < r) t = 1;
        }
        cout << q + t << '\n';
    }

    return 0;
}
0