結果
| 問題 |
No.820 Power of Two
|
| コンテスト | |
| ユーザー |
Dente
|
| 提出日時 | 2019-09-10 21:23:23 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 553 bytes |
| コンパイル時間 | 1,525 ms |
| コンパイル使用メモリ | 165,816 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-02 16:21:47 |
| 合計ジャッジ時間 | 2,155 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 10 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a) for(int i = 0; i < (a); i++)
#define ALL(a) (a).begin(),(a).end()
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9;
const int MOD = 1e9 + 7;
long long mod_pow(long long x, long long n){
long long res = 1;
while(n > 0){
if(n & 1) res = res * x;
x = x * x;
n >>= 1;
}
return res;
}
signed main(){
ll n,k;
cin >> n >> k;
if(n < k){
cout << 0 << endl;
}else{
cout << mod_pow(2, n - k) << endl;
}
}
Dente