結果

問題 No.1281 Cigarette Distribution
ユーザー umezoumezo
提出日時 2020-11-07 04:30:51
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 296 ms / 2,000 ms
コード長 478 bytes
コンパイル時間 1,891 ms
コンパイル使用メモリ 198,860 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-29 20:11:37
合計ジャッジ時間 5,329 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(v) v.begin(),v.end()
typedef long long ll;
 
#include <bits/stdc++.h>
using namespace std;

const ll MOD=1e9+7;

ll modpow(ll x,ll n){
  ll ans=1;
  while(n){
    if(n&1) ans=ans*x %MOD;
    x=x*x %MOD;
    n/=2;
  }
  return ans;
}

int main(){
  ll n,m;
  cin>>n>>m;
  
  for(int i=1;i<=m;i++){
    ll a=(n+1)/i;
    ll b=(n+1)%i;
    cout<<modpow(a+1,b)*modpow(a,i-b-1)%MOD*(a-1)%MOD<<endl;
  }
         
  return 0;
}
0