結果
| 問題 | No.3493 等比数列の和の素因数 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-04-03 22:22:19 |
| 言語 | C++23 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 351 bytes |
| 記録 | |
| コンパイル時間 | 2,999 ms |
| コンパイル使用メモリ | 330,812 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-04-03 22:22:39 |
| 合計ジャッジ時間 | 3,382 ms |
|
ジャッジサーバーID (参考情報) |
judge5_1 / judge4_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 36 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
int main(){
cin.tie(nullptr);
ios::sync_with_stdio(false);
ll n,p;
cin>>n>>p;
if(p==2){
if(n%2==0)cout<<"No"<<endl;
else cout<<"Yes"<<endl;
}else{
if((n+1)%p==0)cout<<"Yes"<<endl;
else if((n+1)%(p-1)==0||gcd(p-1,(n+1))!=1)cout<<"Yes"<<endl;
else cout<<"No"<<endl;
}
}