結果
| 問題 |
No.820 Power of Two
|
| コンテスト | |
| ユーザー |
f843nmfwisfeuw
|
| 提出日時 | 2020-08-15 13:15:31 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 391 ms / 2,000 ms |
| コード長 | 809 bytes |
| コンパイル時間 | 970 ms |
| コンパイル使用メモリ | 93,460 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-10 17:44:11 |
| 合計ジャッジ時間 | 1,959 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 10 |
ソースコード
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <stack>
#include <algorithm>
#include <string>
#include <map>
#include <iterator>
#include <set>
#include <queue>
#include <bitset>
#include <cassert>
using namespace std;
long pow(long x, int n) {
long ans = 1;
while (n > 0) {
if ((n & 1) == 1) {
ans = ans * x;
}
x = x * x;
n = n >> 1;
}
return ans;
}
int main() {
int N, K;
cin >> N >> K;
int cnt = 0;
if (N == K) {
cnt = 1;
} else if (N > K) {
long tmp = pow(2, K);
long tmp2 = pow(2, N);
long i = 1;
while (tmp * i <= tmp2) {
cnt += 1;
i += 1;
}
}
cout << cnt << endl;
return 0;
}
f843nmfwisfeuw