結果

問題 No.3047 Riddle of Cards
ユーザー risujirohrisujiroh
提出日時 2019-04-01 21:38:55
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 553 bytes
コンパイル時間 1,566 ms
コンパイル使用メモリ 164,688 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-17 21:20:40
合計ジャッジ時間 2,135 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 2 ms
4,380 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: 関数 ‘int main()’ 内:
main.cpp:18:34: 警告: 左シフト回数 >= 型の幅となっています [-Wshift-count-overflow]
   18 |     string s = to_string(~(~0ULL << 64));
      |                            ~~~~~~^~~~~

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using lint = unsigned long long;
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;

lint powll(lint a, int n) {
  assert(n >= 0);
  lint res = 1;
  for (; n > 0; a *= a, n >>= 1) if (n & 1) res *= a;
  return res;
}

int main() {
  cin.tie(nullptr); ios::sync_with_stdio(false);
  int n, m; cin >> n >> m;
  if (n == 16 and m == 16) {
    string s = to_string(~(~0ULL << 64));
    ++s.back();
    cout << s << '\n';
    return 0;
  }
  cout << powll(m, n) << '\n';
}
0