結果
| 問題 |
No.415 ぴょん
|
| ユーザー |
|
| 提出日時 | 2020-06-03 17:19:17 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 4 ms / 1,000 ms |
| コード長 | 468 bytes |
| コンパイル時間 | 2,969 ms |
| コンパイル使用メモリ | 191,448 KB |
| 最終ジャッジ日時 | 2025-01-10 20:52:17 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 27 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define FOR(i,b,e) for (int i=(int)(b); i<(int)(e); i++)
#define ALL(x) (x).begin(), (x).end()
const double PI = acos(-1);
long long gcd(long long a, long long b) {
if (b == 0)
return a;
return gcd(b, a%b);
}
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
long long n, d;
cin >> n >> d;
cout << n / gcd(n, d) - 1 << endl;
return 0;
}