結果
問題 |
No.141 魔法少女コバ
|
ユーザー |
![]() |
提出日時 | 2021-10-28 07:09:27 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 600 bytes |
コンパイル時間 | 4,729 ms |
コンパイル使用メモリ | 249,808 KB |
最終ジャッジ日時 | 2025-01-25 07:59:07 |
ジャッジサーバーID (参考情報) |
judge4 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 92 WA * 1 |
ソースコード
#include <stdio.h> #include <bits/stdc++.h> #include <atcoder/all> using namespace atcoder; using mint = modint1000000007; using namespace std; #define rep(i,n) for (int i = 0; i < (n); ++i) #define Inf 1000000000000000000 long long ans = 0LL; void Gcd(long long a,long long b){ //cout<<ans<<','<<a<<','<<b<<endl; if(a==b){ ans += 2; return; } if(a<b){ ans++; swap(a,b); } if(a%b==0){ ans += a/b - 1; return; } ans += (a - (a%b))/b; Gcd(a%b,b); } int main(){ long long m,n; cin>>m>>n; long long g = gcd(m,n); m/=g; n/=g; Gcd(m,n); cout<<ans<<endl; return 0; }