結果
問題 |
No.1281 Cigarette Distribution
|
ユーザー |
|
提出日時 | 2020-11-07 15:52:10 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 60 ms / 2,000 ms |
コード長 | 593 bytes |
コンパイル時間 | 1,532 ms |
コンパイル使用メモリ | 95,348 KB |
最終ジャッジ日時 | 2025-01-15 21:30:40 |
ジャッジサーバーID (参考情報) |
judge3 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 23 |
ソースコード
#include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <numeric> #include <vector> using namespace std; using ll = long long; #define rep(i, j, n) for (int i = j; i < (n); ++i) constexpr ll MOD = 1000000007; ll mpow(ll x, ll e) { ll res = 1; while (e > 0) { if (e & 1) res = res * x % MOD; x = x * x % MOD; e >>= 1; } return res; } int main() { int n, m; cin >> n >> m; rep(i, 1, m + 1) { ll q = (n + 1) / i; ll r = (n + 1) % i; cout << mpow(q + 1, r) * (q - 1) % MOD * mpow(q, i - r - 1) % MOD << '\n'; } return 0; }