結果
| 問題 |
No.333 門松列を数え上げ
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-03-08 09:38:04 |
| 言語 | D (dmd 2.109.1) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 2,000 ms |
| コード長 | 708 bytes |
| コンパイル時間 | 683 ms |
| コンパイル使用メモリ | 117,148 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-12 07:14:44 |
| 合計ジャッジ時間 | 1,204 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 7 |
ソースコード
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 a, b;
int ans;
int mx = 2 * 10^^9;
readVars(a, b);
if(a > b){
ans = (a - b - 1) + (mx - a);
} else {
ans = (b - a - 1) + (a - 1);
}
writeln(ans);
}
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");
}
}