結果
| 問題 |
No.512 魔法少女の追いかけっこ
|
| コンテスト | |
| ユーザー |
moti
|
| 提出日時 | 2018-05-21 00:33:12 |
| 言語 | Perl (5.40.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 465 bytes |
| コンパイル時間 | 34 ms |
| コンパイル使用メモリ | 5,760 KB |
| 実行使用メモリ | 5,760 KB |
| 最終ジャッジ日時 | 2024-06-28 14:51:27 |
| 合計ジャッジ時間 | 1,853 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 51 WA * 2 |
コンパイルメッセージ
Main.pl syntax OK
ソースコード
#!/usr/bin/env perl
use strict;
use warnings;
my ($x, $y) = split / /,<>; chomp $y;
my $n = <>; chomp $n;
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";
moti