結果

問題 No.1281 Cigarette Distribution
ユーザー chocoruskchocorusk
提出日時 2020-11-10 22:57:14
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 304 ms / 2,000 ms
コード長 1,073 bytes
コンパイル時間 1,109 ms
コンパイル使用メモリ 125,968 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-30 00:13:33
合計ジャッジ時間 5,004 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#include <time.h>
#include <stack>
#include <array>
#define popcount __builtin_popcount
using namespace std;
using ll=long long;
typedef pair<int, int> P;
const ll MOD=1e9+7;
ll powmod(ll a, ll k){
    ll ap=a, ans=1;
    while(k){
        if(k&1){
            ans*=ap;
            ans%=MOD;
        }
        ap=ap*ap;
        ap%=MOD;
        k>>=1;
    }
    return ans;
}
int main()
{
    int n, m; cin>>n>>m;
    for(int i=1; i<=m; i++){
        if(i==1){
            cout<<n<<endl;
            continue;
        }
        ll q=n/i, r=n%i;
        if(r<i-1) cout<<powmod(q, i-r-2)*powmod(q+1, r+1)%MOD*(q-1)%MOD<<endl;
        else cout<<powmod(q+1, i-1)*q%MOD<<endl;
    }
    return 0;
}
0