제출 #1119003

#제출 시각아이디문제언어결과실행 시간메모리
1119003Dan4LifeRack (eJOI19_rack)C++17
100 / 100
146 ms504 KiB
#include <iostream>
using namespace std;
using ll=long long;
ll n,k,l,r,M=1e9+7;
ll p(ll b){
	if(!b)return 1;
	ll x=p(b/2);x*=x;x%=M;
	return (x*(b&1?2:1))%M;
}
main(){
	cin>>n>>k,l=1,r=p(n);
	while(n--){
		if(k%2)k++,r=(r+M-p(n))%M;
		else l=(l+p(n))%M;k/=2;
	}
	cout<<l;
}

컴파일 시 표준 에러 (stderr) 메시지

rack.cpp:10:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   10 | main(){
      | ^~~~
rack.cpp: In function 'int main()':
rack.cpp:14:3: warning: this 'else' clause does not guard... [-Wmisleading-indentation]
   14 |   else l=(l+p(n))%M;k/=2;
      |   ^~~~
rack.cpp:14:21: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'else'
   14 |   else l=(l+p(n))%M;k/=2;
      |                     ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...