結果
| 問題 |
No.415 ぴょん
|
| ユーザー |
|
| 提出日時 | 2017-03-08 01:19:42 |
| 言語 | D (dmd 2.109.1) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 1,000 ms |
| コード長 | 698 bytes |
| コンパイル時間 | 820 ms |
| コンパイル使用メモリ | 116,224 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-06-12 07:14:08 |
| 合計ジャッジ時間 | 1,718 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 27 |
ソースコード
import std.stdio, std.string, std.conv, std.array, std.algorithm;
import std.uni, std.range, std.math, std.container, std.datetime;
import core.bitop, std.typetuple, std.typecons;
immutable long MOD = 1_000_000_007;
alias tie = TypeTuple;
void main(){
int N, D;
readVars(N, D);
auto ans = N / gcd(N, D) - 1;
writeln(ans);
}
int gcd(int a, int b){
if(b == 0) return a;
if(b > a) swap(a, b);
return gcd(b, a % b);
}
void readVars(T...)(auto ref T args){
auto line = readln.split;
foreach(ref arg ; args){
arg = line.front.to!(typeof(arg));
line.popFront;
}
if(!line.empty){
throw new Exception("args num < input num");
}
}