結果

問題 No.1671 Permutation Tour
ユーザー Nitit Jongsawatsataporn
提出日時 2021-09-17 03:56:07
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 569 bytes
コンパイル時間 1,291 ms
コンパイル使用メモリ 168,036 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-06-29 17:20:00
合計ジャッジ時間 1,848 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 1
other WA * 14
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
const int mod = 1e9+7;

int add(int a,int b) {
    int g = (a+b)%mod;
    if(g < 0)
        g += mod;
    return g;
}

int mul(int a, int b) {
    long long g = (1LL*a*b)%mod;
    return (int) g;
}

int power(int b, int p) {
    if(p == 0)
        return 1;
    
    int g = power(b,p/2);
    g = mul(g,g);
    if(p%2 == 1)
        g = mul(g,b);
    return g;
}

int inv(int b) {
    return power(b,mod-2);
}

int main() {
    int n; cin>>n;
    cout<<mul(n,mul(mul(mul(n,inv(4)),mul(n,n)),inv(mul(n,n-1))));
    return 0;
}
0