結果
問題 | No.3034 7 problems |
ユーザー | どらら |
提出日時 | 2018-04-03 00:07:21 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 134 ms / 2,000 ms |
コード長 | 2,073 bytes |
コンパイル時間 | 1,754 ms |
コンパイル使用メモリ | 168,532 KB |
実行使用メモリ | 5,888 KB |
最終ジャッジ日時 | 2024-06-26 06:54:12 |
合計ジャッジ時間 | 7,995 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 25 ms
5,760 KB |
testcase_01 | AC | 25 ms
5,760 KB |
testcase_02 | AC | 113 ms
5,760 KB |
testcase_03 | AC | 51 ms
5,760 KB |
testcase_04 | AC | 57 ms
5,760 KB |
testcase_05 | AC | 100 ms
5,760 KB |
testcase_06 | AC | 88 ms
5,760 KB |
testcase_07 | AC | 87 ms
5,760 KB |
testcase_08 | AC | 78 ms
5,760 KB |
testcase_09 | AC | 97 ms
5,760 KB |
testcase_10 | AC | 58 ms
5,632 KB |
testcase_11 | AC | 84 ms
5,760 KB |
testcase_12 | AC | 65 ms
5,760 KB |
testcase_13 | AC | 75 ms
5,760 KB |
testcase_14 | AC | 73 ms
5,632 KB |
testcase_15 | AC | 73 ms
5,760 KB |
testcase_16 | AC | 70 ms
5,760 KB |
testcase_17 | AC | 76 ms
5,760 KB |
testcase_18 | AC | 134 ms
5,632 KB |
testcase_19 | AC | 82 ms
5,760 KB |
testcase_20 | AC | 89 ms
5,760 KB |
testcase_21 | AC | 46 ms
5,760 KB |
testcase_22 | AC | 109 ms
5,760 KB |
testcase_23 | AC | 73 ms
5,760 KB |
testcase_24 | AC | 114 ms
5,760 KB |
testcase_25 | AC | 105 ms
5,760 KB |
testcase_26 | AC | 47 ms
5,760 KB |
testcase_27 | AC | 133 ms
5,632 KB |
testcase_28 | AC | 102 ms
5,760 KB |
testcase_29 | AC | 93 ms
5,760 KB |
testcase_30 | AC | 43 ms
5,760 KB |
testcase_31 | AC | 102 ms
5,632 KB |
testcase_32 | AC | 66 ms
5,760 KB |
testcase_33 | AC | 96 ms
5,760 KB |
testcase_34 | AC | 50 ms
5,760 KB |
testcase_35 | AC | 99 ms
5,760 KB |
testcase_36 | AC | 75 ms
5,760 KB |
testcase_37 | AC | 37 ms
5,760 KB |
testcase_38 | AC | 94 ms
5,760 KB |
testcase_39 | AC | 97 ms
5,760 KB |
testcase_40 | AC | 114 ms
5,760 KB |
testcase_41 | AC | 65 ms
5,760 KB |
testcase_42 | AC | 98 ms
5,760 KB |
testcase_43 | AC | 131 ms
5,760 KB |
testcase_44 | AC | 53 ms
5,760 KB |
testcase_45 | AC | 74 ms
5,888 KB |
testcase_46 | AC | 63 ms
5,888 KB |
testcase_47 | AC | 53 ms
5,760 KB |
testcase_48 | AC | 56 ms
5,760 KB |
testcase_49 | AC | 122 ms
5,760 KB |
testcase_50 | AC | 57 ms
5,888 KB |
testcase_51 | AC | 57 ms
5,760 KB |
testcase_52 | AC | 24 ms
5,760 KB |
ソースコード
#include <bits/stdc++.h> using namespace std; #define REP(i,a,n) for(int i=(a); i<(int)(n); i++) #define rep(i,n) REP(i,0,n) #define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it) #define ALLOF(c) (c).begin(), (c).end() typedef long long ll; typedef unsigned long long ull; const static ll MOD = 1000000007LL; ll mod_pow(ll x, ll n, ll mod){ ll res = 1; while(n>0){ if(n&1) res = res*x%mod; x = x*x%mod; n >>= 1; } return res; } ll extgcd(ll a, ll b, ll &x, ll &y){ ll d = a; if(b!=0){ d = extgcd(b,a%b,y,x); y -= (a/b)*x; }else{ x = 1; y = 0; } return d; } ll mod_inverse(ll a, ll m){ ll x, y; extgcd(a, m, x, y); return (m+x%m)%m; } ll fact[100005]; ll inv_sum[100005]; ll gs[100005]; void init(){ ll f = 1; ll isum = 0; REP(i,1,100005){ ll res = mod_inverse(i, MOD); isum += res; isum %= MOD; inv_sum[i] = isum; f *= (ll)i; f %= MOD; fact[i] = f; } gs[0] = 0; gs[1] = 1; gs[2] = 5; REP(i,3,100005){ gs[i] = (i+1LL) * gs[i-1]; gs[i] %= MOD; gs[i] += fact[i]; gs[i] %= MOD; } } ll solve1(ll N){ //return (N*N)%MOD; return N*N; } ll solve2(ll N){ /* ll ret = 0; ret += (((N*N)%MOD)*N)%MOD; ret %= MOD; ret += (N*N)%MOD; ret %= MOD; ret += MOD-N; ret %= MOD; return ret; */ return N*N*N+N*N-N; } ll solve3(ll N){ return N; } ll solve4(ll N){ //return (4*N*N+17)%MOD; return 4LL*N*N+17; } ll solve5(ll N){ return mod_pow(N, N*N*N, MOD); } ll solve6(ll N){ return N; } ll solve7(ll N){ return (N*gs[N-1])%MOD; /* ll ret = N; ret *= fact[N]; ret %= MOD; ret *= (inv_sum[N] + (MOD-1))%MOD; ret %= MOD; return ret; */ } int main(){ init(); int T; cin >> T; rep(t,T){ int N; cin >> N; if(t>0){ cout << endl; } cout << solve1(N) << endl; cout << solve2(N) << endl; cout << T << endl; cout << solve4(N) << endl; cout << solve5(N) << endl; cout << solve6(N) << endl; cout << solve7(N) << endl; } return 0; }