結果

問題 No.1556 Power Equality
ユーザー mmn15277198mmn15277198
提出日時 2021-06-26 05:45:28
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 490 bytes
コンパイル時間 1,994 ms
コンパイル使用メモリ 164,728 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-07 15:54:58
合計ジャッジ時間 2,043 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 WA -
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 2 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
const long long MOD = (long long)(1e9) + 7;

long long modpow(long long x , long long p) {
  long long ret = 1;
  while (p) {
    if (p % 2) {
      ret *= x;
      ret %= MOD;
    }
    x *= x;
    x %= MOD;
    p /= 2;
  }
  return ret;
}

int main() {
  long long a , b;
  cin >> a >> b;
  long long ans1 = modpow(a , b);
  long long ans2 = modpow(b , a);
  if (ans1 == ans2) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}
0