結果

問題 No.3034 7 problems
ユーザー 👑 kmjpkmjp
提出日時 2020-08-03 18:17:57
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 193 ms / 2,000 ms
コード長 1,572 bytes
コンパイル時間 3,091 ms
コンパイル使用メモリ 200,848 KB
実行使用メモリ 6,244 KB
最終ジャッジ日時 2023-10-11 13:21:31
合計ジャッジ時間 13,146 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 79 ms
6,024 KB
testcase_01 AC 80 ms
5,972 KB
testcase_02 AC 170 ms
5,972 KB
testcase_03 AC 107 ms
5,948 KB
testcase_04 AC 109 ms
6,088 KB
testcase_05 AC 156 ms
6,244 KB
testcase_06 AC 145 ms
5,980 KB
testcase_07 AC 145 ms
6,000 KB
testcase_08 AC 134 ms
5,956 KB
testcase_09 AC 157 ms
5,988 KB
testcase_10 AC 113 ms
5,980 KB
testcase_11 AC 140 ms
5,980 KB
testcase_12 AC 120 ms
6,036 KB
testcase_13 AC 134 ms
6,084 KB
testcase_14 AC 130 ms
6,000 KB
testcase_15 AC 129 ms
5,968 KB
testcase_16 AC 127 ms
6,012 KB
testcase_17 AC 133 ms
5,960 KB
testcase_18 AC 193 ms
5,992 KB
testcase_19 AC 139 ms
5,968 KB
testcase_20 AC 145 ms
5,968 KB
testcase_21 AC 101 ms
6,036 KB
testcase_22 AC 166 ms
5,952 KB
testcase_23 AC 131 ms
5,948 KB
testcase_24 AC 172 ms
5,968 KB
testcase_25 AC 164 ms
6,168 KB
testcase_26 AC 106 ms
6,016 KB
testcase_27 AC 191 ms
6,036 KB
testcase_28 AC 159 ms
5,972 KB
testcase_29 AC 151 ms
5,960 KB
testcase_30 AC 100 ms
5,952 KB
testcase_31 AC 161 ms
6,060 KB
testcase_32 AC 123 ms
5,948 KB
testcase_33 AC 154 ms
6,112 KB
testcase_34 AC 105 ms
5,980 KB
testcase_35 AC 156 ms
6,040 KB
testcase_36 AC 133 ms
5,968 KB
testcase_37 AC 92 ms
6,092 KB
testcase_38 AC 150 ms
6,016 KB
testcase_39 AC 154 ms
5,980 KB
testcase_40 AC 172 ms
5,952 KB
testcase_41 AC 121 ms
5,972 KB
testcase_42 AC 156 ms
6,220 KB
testcase_43 AC 189 ms
5,984 KB
testcase_44 AC 108 ms
6,024 KB
testcase_45 AC 130 ms
6,056 KB
testcase_46 AC 117 ms
6,232 KB
testcase_47 AC 109 ms
5,968 KB
testcase_48 AC 112 ms
5,960 KB
testcase_49 AC 177 ms
6,144 KB
testcase_50 AC 112 ms
5,972 KB
testcase_51 AC 113 ms
5,964 KB
testcase_52 AC 79 ms
5,960 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int T,N;
ll mo=1000000007;
ll C[111010];
ll CS[111010];
ll fact[111010];

ll modpow(ll a, ll n = mo-2) {
	ll r=1;a%=mo;
	while(n) r=r*((n%2)?a:1)%mo,a=a*a%mo,n>>=1;
	return r;
}

ll Q1(int T,ll N) {
	return N*N;
}
ll Q2(int T,ll N) {
	return N*N*N+N*N-N;
}
ll Q3(int T,ll N) {
	return T;
}
ll Q4(int T,ll N) {
	return 4*N*N+17;
}
ll Q5(int T,ll N) {
	return modpow(N,N*N*N);
}
ll Q6(int T,ll N) {
	return N;
}
ll Q7(int T,ll N) {
	return fact[N]*CS[N]%mo;
}



void solve() {
	int i,j,k,l,r,x,y; string s;
	
	ll S=0;
	fact[0]=fact[1]=1;
	for(i=2;i<=110000;i++) {
		C[i]=(S*modpow(i-1)+1)%mo;
		(S+=C[i])%=mo;
		(CS[i]=CS[i-1]+C[i])%=mo;
		fact[i]=fact[i-1]*i%mo;
	}
	
	cin>>T;
	for(i=1;i<=T;i++) {
		cin>>N;
		cout<<Q1(T,N)<<endl;
		cout<<Q2(T,N)<<endl;
		cout<<Q3(T,N)<<endl;
		cout<<Q4(T,N)<<endl;
		cout<<Q5(T,N)<<endl;
		cout<<Q6(T,N)<<endl;
		cout<<Q7(T,N)<<endl;
		if(i!=T) cout<<endl;
		
	}
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}
0