結果
問題 |
No.512 魔法少女の追いかけっこ
|
ユーザー |
![]() |
提出日時 | 2018-05-21 00:37:21 |
言語 | Perl (5.40.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 507 bytes |
コンパイル時間 | 44 ms |
コンパイル使用メモリ | 6,940 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-28 14:51:28 |
合計ジャッジ時間 | 1,557 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 50 WA * 3 |
コンパイルメッセージ
Main.pl syntax OK
ソースコード
#!/usr/bin/env perl use strict; use warnings; my ($x, $y) = split / /,<>; chomp $y; my $n = <>; chomp $n; if ($n <= 2) { print "YES\n"; exit; } my @arr = split/ /,<>; chomp $arr[@arr - 1]; unshift @arr, 0; $n++; my $ratio = $y / $x; my ($xsum, $ysum) = (0, 0); for (my $i = 0; $i < $n - 2; $i++) { my $base = $arr[$i + 1] - $arr[$i]; $xsum += $base; $ysum += $base * $ratio; my $nex = $arr[$i + 2] - $arr[$i + 1]; if ($ysum - $xsum > $nex) { print "NO\n"; exit; } } print "YES\n";