結果
| 問題 |
No.836 じょうよ
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-04-26 22:01:51 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 170 ms / 1,000 ms |
| コード長 | 938 bytes |
| コンパイル時間 | 1,978 ms |
| コンパイル使用メモリ | 113,840 KB |
| 最終ジャッジ日時 | 2025-01-21 01:17:22 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 41 |
ソースコード
#include <algorithm>
#include <array>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <numeric>
#include <optional>
#include <queue>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
int main() {
int64_t l, r, n;
cin >> l >> r >> n;
int64_t lmin = l, lmax = (l + n - 1) / n * n;
int64_t rmin = r / n * n, rmax = r + 1;
vector<int64_t> ans(n);
if (lmax <= rmin) {
for (auto i = 0; i < n; ++i) {
ans[i] = (rmin - lmax) / n;
}
for (auto ll = lmin; ll < lmax; ++ll) {
++ans[ll % n];
}
for (auto rr = rmin; rr < rmax; ++rr) {
++ans[rr % n];
}
} else {
for (auto i = l; i <= r; ++i) {
++ans[i % n];
}
}
for (auto i = 0; i < n; ++i) {
cout << ans[i] << endl;
}
return 0;
}