結果
問題 | No.8034 7 problems |
ユーザー | どらら |
提出日時 | 2018-04-02 01:02:29 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,927 bytes |
コンパイル時間 | 1,784 ms |
コンパイル使用メモリ | 169,104 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-26 06:25:30 |
合計ジャッジ時間 | 7,599 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 23 ms
5,248 KB |
testcase_01 | AC | 24 ms
5,376 KB |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | WA | - |
testcase_23 | WA | - |
testcase_24 | WA | - |
testcase_25 | WA | - |
testcase_26 | WA | - |
testcase_27 | WA | - |
testcase_28 | WA | - |
testcase_29 | WA | - |
testcase_30 | WA | - |
testcase_31 | WA | - |
testcase_32 | WA | - |
testcase_33 | WA | - |
testcase_34 | WA | - |
testcase_35 | WA | - |
testcase_36 | WA | - |
testcase_37 | WA | - |
testcase_38 | WA | - |
testcase_39 | WA | - |
testcase_40 | WA | - |
testcase_41 | WA | - |
testcase_42 | WA | - |
testcase_43 | WA | - |
testcase_44 | WA | - |
testcase_45 | WA | - |
testcase_46 | WA | - |
testcase_47 | WA | - |
testcase_48 | WA | - |
testcase_49 | WA | - |
testcase_50 | WA | - |
testcase_51 | WA | - |
testcase_52 | WA | - |
ソースコード
#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]; 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; } } 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; } ll solve3(ll N){ double f = 1; REP(i,1,100005){ f *= i; if(f - 1e-6 > N) return i-1; } return 0; } 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){ 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 << solve3(N) << endl; cout << solve4(N) << endl; cout << solve5(N) << endl; cout << solve6(N) << endl; cout << solve7(N) << endl; } return 0; }