답안 #973274

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
973274 2024-05-01T17:21:53 Z terracottalite Rack (eJOI19_rack) C++14
40 / 100
1 ms 572 KB
#include <stdio.h>

#define MOD 1000000007

long long fastpow(long long base, long long exp) {
	if (exp == 0) return 1;
	long long x = fastpow(base, exp / 2);
	x = (x * x)%MOD;
	if (exp&1) x = (x * base)%MOD;
	return x;
}

int main()
{
	int n, k;
	scanf("%d %d", &n, &k);

	k--;

	int z = n-1;

	long long ans = 0;

	while (k) {
		if (k&1) ans = (ans + fastpow(2, z))%MOD;
		z--;
		k >>= 1;
	}

	ans = (ans + 1)%MOD;

	printf("%lld\n", ans);
}

Compilation message

rack.cpp: In function 'int main()':
rack.cpp:16:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   16 |  scanf("%d %d", &n, &k);
      |  ~~~~~^~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 1 ms 572 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 1 ms 572 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Incorrect 0 ms 348 KB Output isn't correct
13 Halted 0 ms 0 KB -