結果

問題 No.836 じょうよ
ユーザー toof
提出日時 2019-06-14 21:42:06
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 124 ms / 1,000 ms
コード長 752 bytes
コンパイル時間 1,305 ms
コンパイル使用メモリ 159,460 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-09 00:44:07
合計ジャッジ時間 3,792 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 41
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
#define rep(i, n) for(ll i = 0;i < n;i++)
#define all(i) i.begin(), i.end()
template<class T, class U> bool cmax(T& a, U b) { if (a<b) {a = b; return true;} else return false; }
template<class T, class U> bool cmin(T& a, U b) { if (a>b) {a = b; return true;} else return false; }

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

  ll l, r, n;
  cin >> l >> r >> n;
  vector<ll> ans(n);
  int cnt = 0;
  int a = l%n;
  cnt += n-1-a+1;
  int b = r%n;
  cnt += b+1;
  ll base = (r-l+1-cnt)/n;
  rep(i, n) {
    ll ans = base;
    if (i >= a) ans++;
    if (i <= b) ans++;
    cout << ans << endl;
  }
}
0