답안 #73251

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
73251 2018-08-28T06:00:21 Z maus1208 Asceticism (JOI18_asceticism) C++14
0 / 100
3 ms 348 KB
#import<bits/stdc++.h>
using namespace std;

#define sysp system("pause")
#define mod 1000000007
#define rmod 1000000005

typedef long long ll;

ll n,k,ans;
vector<ll> f,rf;

ll mypow(ll x,ll n){
	ll ret=1;
	while(n>0){
		if((n&1)==1){
			ret*=x%mod;
		}
		x*=x%mod;
		n>>=1;
	}
	return ret%mod;
}

void init(){
	f[0]=1;
	rf[0]=1;
	for(ll i=1;i<=100010;i++){
		f[i]*=i*f[i-1]%mod;
		rf[i]=mypow(f[i],rmod);
	}
}

int main(){
	cin>>n>>k;
	ll tmp=-1;
	init();
	for(ll i=0;i<=k;i++){
		tmp*=-1;
		ans+=f[n+1]*rf[i]*rf[n+1-i]*tmp*mypow((k-i+1),n)%mod;
	}
	cout<<ans<<endl;
	sysp;
}

Compilation message

asceticism.cpp:1:2: warning: #import is a deprecated GCC extension [-Wdeprecated]
 #import<bits/stdc++.h>
  ^~~~~~
asceticism.cpp: In function 'int main()':
asceticism.cpp:4:20: warning: ignoring return value of 'int system(const char*)', declared with attribute warn_unused_result [-Wunused-result]
 #define sysp system("pause")
              ~~~~~~^~~~~~~~~
asceticism.cpp:43:2: note: in expansion of macro 'sysp'
  sysp;
  ^~~~
# 결과 실행 시간 메모리 Grader output
1 Runtime error 3 ms 348 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 3 ms 348 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 3 ms 348 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 3 ms 348 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -