結果
問題 | No.8034 7 problems |
ユーザー |
![]() |
提出日時 | 2018-04-02 16:09:12 |
言語 | C++11 (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,230 bytes |
コンパイル時間 | 677 ms |
コンパイル使用メモリ | 73,188 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-06-26 06:38:49 |
合計ジャッジ時間 | 10,594 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | WA * 51 |
ソースコード
#include <iostream>#include <vector>#include <string>#include <cmath>#include <algorithm>#include <utility>#include <queue>#include <set>#include <map>using namespace std;typedef long long ll;typedef pair<int,int> PII;typedef vector<int> VI;typedef vector<VI> VVI;#define MP make_pair#define PB push_backll mod = 1000000007;long long calc(long long k,long long m,long long p){if(m==0)return 1;if(m==1)return k%p;long long s = calc(k,m/2,p);if(m%2==0){return (s*s)%p;}else{long long ans;ans = (s*s)%p;return (k*ans)%p;}}ll dp[100010];ll kai[100010];int main(){int t;cin >> t;dp[0] = 0;for(ll i=1;i<=100000;i++){dp[i] = (dp[i-1]+1 + dp[i-1]*calc(i,mod-2,mod))%mod;}kai[0] = 1;for(ll i=1;i<=100000;i++){kai[i] = (i*kai[i-1])%mod;}for(int i=0;i<t;i++){ll n;cin >> n;cout << (n*n)%mod << endl;cout << (n*n*n+n*n-n)%mod << endl;cout << t << endl;cout << (4*n*n+17)%mod << endl;cout << calc(n,calc(n,3,mod-1),mod) << endl;cout << n << endl;cout << (dp[n-1]*kai[n])%mod << endl;if(i!=(t-1))cout << endl;}return 0;}