結果

問題 No.48 ロボットの操縦
ユーザー shiCanoko_oshiCanoko_o
提出日時 2019-07-06 00:31:24
言語 Perl
(5.38.2)
結果
WA  
実行時間 -
コード長 422 bytes
コンパイル時間 665 ms
コンパイル使用メモリ 5,332 KB
実行使用メモリ 5,372 KB
最終ジャッジ日時 2023-10-23 19:20:44
合計ジャッジ時間 1,517 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
5,344 KB
testcase_01 AC 3 ms
5,344 KB
testcase_02 AC 3 ms
5,344 KB
testcase_03 AC 3 ms
5,344 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 3 ms
5,344 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 3 ms
5,344 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 3 ms
5,344 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 3 ms
5,344 KB
testcase_17 AC 3 ms
5,344 KB
testcase_18 AC 3 ms
5,344 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 3 ms
5,344 KB
testcase_23 AC 3 ms
5,344 KB
testcase_24 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.pl syntax OK

ソースコード

diff #

my $X = <>;
my $Y = <>;
my $K = <>;

#to make a positive number
my $pX = sqrt($X*$X);
my $pY = sqrt($Y*$Y);

my $remainder = ($pX+$pY) % $K;
my $count = ($pX + $pY - $remainder)/$K;

my $count_r;

if($remainder != 0){
    $count_r = 1;
}else{
    $count_r = 0;
}

my $turn;

if($X == 0 && $Y > 0){
    $turn = 0;
}elsif($Y < 0){
    $turn = 2;
}else{
    $turn = 1;
}

my $ans = $count + $count_r + $turn;

print "$ans\n";
0