結果
| 問題 |
No.415 ぴょん
|
| ユーザー |
algon_320
|
| 提出日時 | 2016-08-27 00:28:46 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 1,000 ms |
| コード長 | 1,011 bytes |
| コンパイル時間 | 1,612 ms |
| コンパイル使用メモリ | 167,784 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-11-18 14:43:04 |
| 合計ジャッジ時間 | 2,236 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 27 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define ITR(v,c) for(auto v=begin(c);v!=end(c);v++)
#define FOR(v,a,n) for(int v=a;v<(int)(n);v++)
#define FORE(x,arr) for(auto &x:arr)
#define REP(v,n) FOR(v,0,n)
#define ALL(c) begin(c),end(c)
const int DX[4]={0,1,0,-1}, DY[4]={-1,0,1,0};
const int INF = 1e9;
const ll INFLL = 1e18;
template<class T,class U>ostream&operator<<(ostream &os,const pair<T,U> &p){
os<<"("<<p.first<<","<<p.second<<")";return os;}
template<class T>ostream&operator<<(ostream &os,const vector<T> &v){
ITR(i,v)os<<*i<<(i==end(v)-1?"":" ");return os;}
//------------------------------------------------------------------------------
ll gcd(ll a,ll b) {
ll r;
if(a<b) swap(a,b);
while((r=a%b)!=0) a=b,b=r;
return b;
}
ll lcm(ll a,ll b) {
if(a==0 or b==0) return 0;
return (a/gcd(a,b))*b;
}
int main(int argc, char const *argv[]) {
ll N,D;
cin>>N>>D;
cout<<(lcm(N,D)/D)-1<<endl;
return 0;
}
algon_320