結果
| 問題 |
No.48 ロボットの操縦
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-04-09 23:03:50 |
| 言語 | D (dmd 2.109.1) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 436 bytes |
| コンパイル時間 | 885 ms |
| コンパイル使用メモリ | 100,640 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-06-12 03:27:44 |
| 合計ジャッジ時間 | 1,810 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 25 |
ソースコード
import std.stdio, std.conv, std.string, std.range, std.array, std.algorithm, std.math;
int main(){
auto X = readln.strip.to!int;
auto Y = readln.strip.to!int;
auto L = readln.strip.to!int;
if(Y>=0){
if(X==0){
num(Y,L).writeln;
}else{
(num(Y,L)+1+num(X,L)).writeln;
}
}else{
(1+num(X,L)+1+num(Y,L)).writeln;
}
return 0;
}
int num(int n, int L){
n=abs(n);
return n==0 ? 0 : (n/L).to!int + (n%L == 0 ? 0 : 1);
}