結果

問題 No.1281 Cigarette Distribution
ユーザー leaf_1415leaf_1415
提出日時 2020-11-07 00:07:22
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,189 bytes
コンパイル時間 557 ms
コンパイル使用メモリ 74,280 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-29 19:48:22
合計ジャッジ時間 4,008 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 2 ms
4,376 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstdlib>
#include <cassert>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <string>
#include <algorithm>
#include <utility>
#define rep(x, s, t) for(llint (x) = (s); (x) <= (t); (x)++)
#define chmin(x, y) (x) = min((x), (y))
#define chmax(x, y) (x) = max((x), (y))
#define all(x) (x).begin(),(x).end()
#define inf 1e18
#define mod 1000000007

using namespace std;

typedef long long llint;
typedef pair<llint, llint> P;

llint modpow(llint a, llint n)
{
	if(n == 0) return 1;
	if(n % 2){
		return ((a%mod) * (modpow(a, n-1)%mod)) % mod;
	}
	else{
		return modpow((a*a)%mod, n/2) % mod;
	}
}

llint n, m;

int main(void)
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	cin >> n >> m;
	cout << n << endl;
	rep(i, 2, m){
		if(n/i == 0){
			cout << 0 << endl;
			continue;
		}
		llint ans = modpow((n+i-1)/i, n%i);
		ans *= modpow(n/i, i-n%i), ans %= mod;
		if(n%i == 0){
			ans *= modpow(n/i, mod-2), ans %= mod;
			ans *= (n/i-1), ans %= mod;
			ans *= (n/i+1), ans %= mod;
		}
		cout << ans << endl;
	}
	
	return 0;
}
0