結果
| 問題 |
No.8034 7 problems
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-03-30 21:03:16 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 22 ms / 2,000 ms |
| コード長 | 1,382 bytes |
| コンパイル時間 | 764 ms |
| コンパイル使用メモリ | 78,100 KB |
| 実行使用メモリ | 9,100 KB |
| 最終ジャッジ日時 | 2024-06-26 01:19:59 |
| 合計ジャッジ時間 | 5,115 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 51 |
ソースコード
#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;
}