結果

問題 No.1281 Cigarette Distribution
ユーザー bachoppibachoppi
提出日時 2020-11-17 11:37:37
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 446 ms / 2,000 ms
コード長 962 bytes
コンパイル時間 1,022 ms
コンパイル使用メモリ 117,664 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-30 14:06:51
合計ジャッジ時間 5,957 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 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,376 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 1 ms
4,384 KB
testcase_12 AC 108 ms
4,376 KB
testcase_13 AC 263 ms
4,380 KB
testcase_14 AC 187 ms
4,376 KB
testcase_15 AC 128 ms
4,376 KB
testcase_16 AC 162 ms
4,380 KB
testcase_17 AC 3 ms
4,380 KB
testcase_18 AC 441 ms
4,376 KB
testcase_19 AC 441 ms
4,376 KB
testcase_20 AC 446 ms
4,376 KB
testcase_21 AC 219 ms
4,380 KB
testcase_22 AC 272 ms
4,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: 関数 ‘int modpow(ll, ll, ll)’ 内:
main.cpp:34:1: 警告: 制御が非 void 関数の終りに到達しました [-Wreturn-type]
   34 | }
      | ^

ソースコード

diff #

#include<iostream>
#include<string>
#include<cstring>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;
#define PI 3.141592653589793

int modpow(ll a, ll n, ll p){
	if(n==0) return 1;
	if(n%2) return (a*modpow(a, n-1, p))%p;
	if(!(n%2)){
		ll t=modpow(a, n/2, p);
		return (t*t)%p;
	}
}


int main(){
  int N, M; cin >> N >> M;
  for(int i=1; i<=M; i++){
    ll kiri = N/i;
    if(i-N%i==1){
      cout << kiri*modpow(kiri+1, N%i, mod)%mod << endl;
       continue;
    }
    cout << (kiri-1)*modpow(kiri, i-N%i-2, mod)%mod*modpow(kiri+1, N%i+1, mod)%mod << endl;
  }
}
0