Submission #67608

#TimeUsernameProblemLanguageResultExecution timeMemory
67608NordwayKangaroo (CEOI16_kangaroo)C++14
0 / 100
3 ms472 KiB
#include<bits/stdc++.h>

#define x first
#define y second
#define pb push_back
#define mp make_pair
#define up_b upper_bound
#define low_b lower_bound
#define sz(x) (int)x.size()
#define all(v) v.begin(),v.end()

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<int,ll> pil;
typedef pair<ll,int> pli;
typedef pair<ll,ll> pll;

const ll INF = 1e18;
const int inf = INT_MAX;
const ll mod = 1e9 + 7;
const int dx[4] = {0, 0, 1, -1};
const int dy[4] = {1, -1, 0, 0};
const int N = 1e5 + 5;
const int A = 26;

ll fact(ll n){
	ll res = 1;
	while(n > 1){
		res = (res * ((n / mod) % 2 ? mod - 1 : 1)) % mod;
		for(ll i = 2; i <= n % mod; i++){
			res = (res * i) % mod;
		}
		n /= mod;
	}
	return res % mod;
}

int main(){
	ll n, cs, cf;
	cin >> n >> cs >> cf;
	cout << fact(n - 2);
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...