Submission #67607

# Submission time Handle Problem Language Result Execution time Memory
67607 2018-08-15T05:55:27 Z Nordway Kangaroo (CEOI16_kangaroo) C++14
0 / 100
3 ms 488 KB
#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 int 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;

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

int main(){
	int n, cs, cf;
	cin >> n >> cs >> cf;
	cout << fact(n - 2);
}
# Verdict Execution time Memory Grader output
1 Correct 3 ms 248 KB Output is correct
2 Incorrect 2 ms 488 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 248 KB Output is correct
2 Incorrect 2 ms 488 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 248 KB Output is correct
2 Incorrect 2 ms 488 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 248 KB Output is correct
2 Incorrect 2 ms 488 KB Output isn't correct