結果

問題 No.3034 7 problems
ユーザー ミドリムシミドリムシ
提出日時 2018-03-30 21:03:16
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 21 ms / 2,000 ms
コード長 1,382 bytes
コンパイル時間 772 ms
コンパイル使用メモリ 76,968 KB
実行使用メモリ 8,888 KB
最終ジャッジ日時 2023-09-08 08:00:44
合計ジャッジ時間 7,181 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 6 ms
8,112 KB
testcase_01 AC 7 ms
8,128 KB
testcase_02 AC 19 ms
8,836 KB
testcase_03 AC 10 ms
8,428 KB
testcase_04 AC 10 ms
8,136 KB
testcase_05 AC 16 ms
8,432 KB
testcase_06 AC 15 ms
8,436 KB
testcase_07 AC 14 ms
8,300 KB
testcase_08 AC 14 ms
8,492 KB
testcase_09 AC 16 ms
8,432 KB
testcase_10 AC 11 ms
8,108 KB
testcase_11 AC 13 ms
8,432 KB
testcase_12 AC 12 ms
8,112 KB
testcase_13 AC 14 ms
8,492 KB
testcase_14 AC 13 ms
8,432 KB
testcase_15 AC 13 ms
8,504 KB
testcase_16 AC 13 ms
8,640 KB
testcase_17 AC 14 ms
8,428 KB
testcase_18 AC 20 ms
8,692 KB
testcase_19 AC 14 ms
8,312 KB
testcase_20 AC 14 ms
8,428 KB
testcase_21 AC 9 ms
8,348 KB
testcase_22 AC 18 ms
8,728 KB
testcase_23 AC 12 ms
8,312 KB
testcase_24 AC 19 ms
8,884 KB
testcase_25 AC 18 ms
8,872 KB
testcase_26 AC 10 ms
8,232 KB
testcase_27 AC 21 ms
8,876 KB
testcase_28 AC 16 ms
8,436 KB
testcase_29 AC 15 ms
8,348 KB
testcase_30 AC 9 ms
8,116 KB
testcase_31 AC 16 ms
8,644 KB
testcase_32 AC 11 ms
8,496 KB
testcase_33 AC 15 ms
8,532 KB
testcase_34 AC 10 ms
8,108 KB
testcase_35 AC 15 ms
8,428 KB
testcase_36 AC 13 ms
8,432 KB
testcase_37 AC 8 ms
8,248 KB
testcase_38 AC 15 ms
8,380 KB
testcase_39 AC 15 ms
8,448 KB
testcase_40 AC 18 ms
8,888 KB
testcase_41 AC 12 ms
8,460 KB
testcase_42 AC 16 ms
8,328 KB
testcase_43 AC 19 ms
8,708 KB
testcase_44 AC 11 ms
8,252 KB
testcase_45 AC 13 ms
8,428 KB
testcase_46 AC 12 ms
8,184 KB
testcase_47 AC 11 ms
8,240 KB
testcase_48 AC 11 ms
8,240 KB
testcase_49 AC 19 ms
8,824 KB
testcase_50 AC 11 ms
8,180 KB
testcase_51 AC 11 ms
8,128 KB
testcase_52 AC 7 ms
8,120 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;

#define mod long(1e9 + 7)

long power(long base, long exponent){
    if(exponent % 2){
        return power(base, exponent - 1) * base % mod;
    }else if(exponent){
        long root_ans = power(base, exponent / 2);
        return root_ans * root_ans % mod;
    }else{
        return 1;
    }
}

int main(){
    int T;
    cin >> T;
    long factorial[int(2e5)];
    factorial[0] = 1;
    for(long i = 1; i < 2e5; i++){
        factorial[i] = factorial[i - 1] * i % mod;
    }
    long K[int(2e5)];
    K[1] = 0;
    for(long i = 2; i < 2e5; i++){
        K[i] = (factorial[i - 2] + (i - 1) * K[i - 1]) % mod;
    }
    long S[int(2e5)];
    S[1] = 0;
    for(long i = 2; i < 2e5; i++){
        S[i] = ((i - 1) * S[i - 1] + K[i]) % mod;
    }
    string ans_string;
    for(int i = 0; i < T; i++){
        long N;
        cin >> N;
        ans_string += to_string(N * N) + "\n";
        ans_string += to_string(N * N * N + N * N - N) + "\n";
        ans_string += to_string(T) + "\n";
        ans_string += to_string(4 * N * N + 17) + "\n";
        ans_string += to_string(power(N, N * N * N)) + "\n";
        ans_string += to_string(N) + "\n";
        ans_string += to_string((S[N] * N) % mod) + "\n\n";
    }
    ans_string.pop_back();
    ans_string.pop_back();
    cout << ans_string << endl;
}

0