제출 #774642

#제출 시각아이디문제언어결과실행 시간메모리
774642OzyKućice (COCI21_kucice)C++17
10 / 110
1 ms340 KiB
#include <iostream> #include <bits/stdc++.h> using namespace std; #define lli long long int #define debug(a) cout << #a << " = " << a << endl #define debugsl(a) cout << #a << " = " << a << ", " #define rep(i,a,b) for(lli i = (a); i <= (b); i++) #define repa(i,a,b) for(lli i = (a); i >= (b); i--) #define pll pair<lli,lli> #define mod 1000000007 lli a,b,n,res,act; lli expo(lli num, lli pot) { lli res = 1; while (pot) { if (pot&1) { res *= num; res %= mod; } num *= num; num %=mod; pot /= 2; } return res; } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cin >> n; rep(i,1,n) cin >> a >> b; act = 1; res = 0; rep(i,0,n) { res += act*i; res %= mod; act *= (n-i); act %= mod; act *= expo(i+1,mod-2); act %= mod; //debugsl(act); //debugsl(i); //debug(res); } cout << res; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...