답안 #280257

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
280257 2020-08-22T15:16:38 Z antontsiorvas Rack (eJOI19_rack) C++14
100 / 100
6 ms 416 KB
#include <cstdio>

int ans[1000005];

void f(int n, long long int coats){
	if(n == 0 || coats == 1) return;
	if(coats%2) ans[n] = 1;
	else ans[n] = 2;
	return f(n-1,coats-coats/2);
}

int main(){
	int N, MOD = 1000000007;
	long long int K, pos=1, jump=1;
	scanf("%d%lld",&N,&K);
	f(N,K);
	for(int i=1; i<=N; i++){
		if(ans[i] == 2) pos += jump;
		pos %= MOD;
		jump %= MOD;
		jump *= 2; 
	}
	printf("%lld",pos);
}

Compilation message

rack.cpp: In function 'int main()':
rack.cpp:15:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   15 |  scanf("%d%lld",&N,&K);
      |  ~~~~~^~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Correct 0 ms 256 KB Output is correct
5 Correct 0 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Correct 0 ms 256 KB Output is correct
5 Correct 0 ms 256 KB Output is correct
6 Correct 1 ms 288 KB Output is correct
7 Correct 0 ms 256 KB Output is correct
8 Correct 1 ms 256 KB Output is correct
9 Correct 1 ms 256 KB Output is correct
10 Correct 0 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Correct 0 ms 256 KB Output is correct
5 Correct 0 ms 256 KB Output is correct
6 Correct 1 ms 288 KB Output is correct
7 Correct 0 ms 256 KB Output is correct
8 Correct 1 ms 256 KB Output is correct
9 Correct 1 ms 256 KB Output is correct
10 Correct 0 ms 256 KB Output is correct
11 Correct 0 ms 256 KB Output is correct
12 Correct 1 ms 416 KB Output is correct
13 Correct 1 ms 256 KB Output is correct
14 Correct 1 ms 256 KB Output is correct
15 Correct 6 ms 256 KB Output is correct