結果

問題 No.48 ロボットの操縦
ユーザー Tosuke
提出日時 2016-04-09 22:52:56
言語 D
(dmd 2.109.1)
結果
WA  
実行時間 -
コード長 434 bytes
コンパイル時間 572 ms
コンパイル使用メモリ 99,628 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-06-12 03:27:26
合計ジャッジ時間 1,359 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 23 WA * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

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);
}
0