結果

問題 No.1184 Hà Nội
ユーザー Californiumer
提出日時 2020-08-22 17:06:10
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 557 bytes
コンパイル時間 1,962 ms
コンパイル使用メモリ 166,276 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-15 11:02:55
合計ジャッジ時間 2,477 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 27
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
int pow_kai(long long a, long long n){//aのn乗を計算します。
  long long waru=998244353;
  long long x = 1;
  while(n > 0){//全てのbitが捨てられるまで。
    if(n&1){//1番右のbitが1のとき。
      x = (x*a)%waru;
    }
    a = a*a%waru;
    n >>= 1;//bit全体を右に1つシフトして一番右を捨てる。
  }
  return x;
}
int main() {
  long long N,L;cin>>N>>L;
  if(N%L==0){
        cout<<pow_kai(2,N/L)-1<<endl;
  }
    else{
        cout<<pow_kai(2,N/L+1)-1<<endl;
    }
}
0