結果
問題 |
No.1281 Cigarette Distribution
|
ユーザー |
![]() |
提出日時 | 2020-11-06 22:43:02 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 903 bytes |
コンパイル時間 | 2,057 ms |
コンパイル使用メモリ | 194,844 KB |
最終ジャッジ日時 | 2025-01-15 21:08:14 |
ジャッジサーバーID (参考情報) |
judge1 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 5 WA * 18 |
ソースコード
#include <stdio.h> #include <bits/stdc++.h> #include <atcoder/modint> using namespace atcoder; using mint = modint1000000007; using namespace std; #define rep(i,n) for (int i = 0; i < (n); ++i) #define Inf 10000000000000000 int main(){ int N,M; cin>>N>>M; for(int i=1;i<=M;i++){ if(i==1){ cout<<N<<endl; continue; } if(i==2){ long long x = 0,y = 0; rep(i,N){ if(x>y)swap(x,y); x += 2; if(x>y)swap(x,y); x--; } cout<<mint(x*y).val()<<endl; continue; } if((N+1)/2<i){ cout<<0<<endl; continue; } long long a = (N-1)/(i-1); long long b = a+1; long long ok = 0,ng = i-1; while(ng-ok>1){ long long mid = (ok+ng)/2; if(mid*b+((long long)i-1-mid)*a > (N-1))ng = mid; else ok = mid; } mint ans = mint(a).pow(i-1-ok); ans *= mint(b).pow(ok); //ans *= 2; cout<<ans.val()<<endl; } return 0; }