結果
| 問題 | No.1281 Cigarette Distribution |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-11-06 22:07:32 |
| 言語 | C++14 (gcc 15.3.0 + boost 1.92.0 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 409 ms / 2,000 ms |
| + 252µs | |
| コード長 | 1,264 bytes |
| 記録 | |
| コンパイル時間 | 609 ms |
| コンパイル使用メモリ | 108,140 KB |
| 実行使用メモリ | 9,796 KB |
| 最終ジャッジ日時 | 2026-10-19 21:21:55 |
| 合計ジャッジ時間 | 5,480 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 24 |
ソースコード
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <deque>
#include <cstdio>
#include <set>
#include <map>
#include <bitset>
#include <stack>
#include <cctype>
using namespace std;
int main() {
long long n, m;
cin >> n >> m;
for (int i = 1; i <= m; i++) {
long long x, y, ans;
long long n1 = n;
if (n <= i * 2 - 2) {
cout << "0" << endl;
}
else {
long long ans3 = 1;
n1 -= i * 2 - 1;
x = 2 + n1 / i;
y = i - n1 % i;
ans = 1;
while (y > 0) {
if ((y & 1) == 1) {
ans = ans * x % 1000000007;
}
x = x * x % 1000000007;
y >>= 1;
}
x = 2 + n1 / i + 1;
y = n1 % i;
long long ans1 = 1;
while (y > 0) {
if ((y & 1) == 1) {
ans1 = ans1 * x % 1000000007;
}
x = x * x % 1000000007;
y >>= 1;
}
x= 2 + n1 / i;
y = i - n1 % i - 1;
long long ans2 = 1;
while (y > 0) {
if ((y & 1) == 1) {
ans2 = ans2 * x % 1000000007;
}
x = x * x % 1000000007;
y >>= 1;
}
ans3 = (ans * ans1) % 1000000007;
ans3 = ans3 - ((ans1 * ans2) % 1000000007);
ans3 %= 1000000007;
if (ans3 < 0) {
ans3 += 1000000007;
}
cout << ans3 << endl;
}
}
}