結果

問題 No.8034 7 problems
ユーザー mtsd
提出日時 2018-04-02 16:23:59
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 196 ms / 2,000 ms
コード長 1,212 bytes
コンパイル時間 745 ms
コンパイル使用メモリ 73,016 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-06-26 06:41:03
合計ジャッジ時間 11,243 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 51
権限があれば一括ダウンロードができます

ソースコード

diff #

#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_back

ll 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 << endl;
        cout << n*n*n+n*n-n << endl;
        cout << t << endl;
        cout << 4*n*n+17 << 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;
}
0