제출 #1117716

#제출 시각아이디문제언어결과실행 시간메모리
1117716vjudge1캥거루 (CEOI16_kangaroo)C++14
0 / 100
1 ms336 KiB
#include <bits/stdc++.h> using namespace std; #define endl '\n' #define pb push_back #define F first #define S second #define ll long long #define int ll #define pii pair<int, int> #define io ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0) #define M_PI 3.14159265358979323846 #define all(v) v.begin(), v.end() #define pss pair<string, string> #define no cout<<"No"<<endl; #define yes cout<<"Yes"<<endl; #define imp cout<<-1<<endl; #define flu cout.flush(); #define Endl endl const int N = 100009; const int mod = 1e9+7; void solve(){ int n, start, finish; cin>>n>>start>>finish; int dp[2005][3]; int boyuk=0, kicik=0; if(finish<start){ swap(finish, start); } kicik=finish-1; boyuk=n-finish-1; dp[1][0]=1; dp[1][1]=1; int q=1; for(int i=2; i<=n; i++){ dp[i][0]=(dp[i-1][1]*((kicik-q)%mod))%mod; dp[i][1]=(dp[i-1][0]*((boyuk-q)%mod))%mod; q++; } cout<<max(dp[n][0], dp[n][1])%mod; } signed main(){ io; int t=1; //cin>>t; while(t--){ solve(); } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...