結果
問題 | No.1579 New Type of Nim |
ユーザー |
![]() |
提出日時 | 2021-07-24 19:17:33 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 735 bytes |
コンパイル時間 | 1,844 ms |
コンパイル使用メモリ | 166,536 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-23 05:25:16 |
合計ジャッジ時間 | 2,632 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 31 |
ソースコード
#include <bits/stdc++.h> using namespace std; #define ll long long #define rep(i,n) for(int (i)=0;(i)<(n);(i)++) #define Pr pair<ll,ll> #define Tp tuple<ll,ll,ll> using Graph = vector<vector<int>>; const ll mod = 1000000007; //累乗 aのb乗、正しmを法として求める long long pw(long long a,long long b,long long m){ if(b==0) return 1; else if(b%2==0){ long long x = pw(a,b/2,m); return (x*x)%m; } else{ long long x = pw(a,b-1,m); return (a*x)%m; } } int main() { std::ios::sync_with_stdio(false); std::cin.tie(nullptr); ll A,B; cin >> A >> B; string ans = "P"; if((abs(A-B)==1&&min(A,B)%2==1)||(A==B&&A%2==1)) ans = "Q"; cout << ans << endl; }