結果

問題 No.820 Power of Two
ユーザー treeone
提出日時 2019-04-26 21:22:40
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 532 bytes
コンパイル時間 2,011 ms
コンパイル使用メモリ 191,804 KB
最終ジャッジ日時 2025-01-07 03:03:05
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define int long long
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e18;

long long mod_pow(long long x, long long n){
    if(n == 0) return 1;
    long long res = mod_pow(x*x, n / 2);
    if(n & 1) res = res*x;
    return res;
}

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n, k;
    cin >> n >> k;
    if(n >= k) cout << mod_pow(2, n - k) << endl;
    else cout << 0 << endl;
}
0