結果
| 問題 | No.193 筒の数式 |
| コンテスト | |
| ユーザー |
moti
|
| 提出日時 | 2018-05-24 02:04:57 |
| 言語 | Perl (5.40.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 637 bytes |
| 記録 | |
| コンパイル時間 | 187 ms |
| コンパイル使用メモリ | 7,296 KB |
| 実行使用メモリ | 7,296 KB |
| 最終ジャッジ日時 | 2024-06-28 16:42:26 |
| 合計ジャッジ時間 | 1,139 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 9 WA * 7 |
コンパイルメッセージ
Main.pl syntax OK
ソースコード
#!/usr/bin/env perl
use strict;
use warnings;
use Data::Dumper;
my $s = <>; chomp $s;
my $n = length $s;
my @sa = split //, $s . $s;
my $ma = 0;
for (my $i = 0; $i < $n; $i++) {
my @ea = @sa[$i..($i+$n-1)];
my $es = "";
my $leading0 = 1;
for my $c (@ea) {#(my $k = 0; $k < @ea; $k++) {
if ($c ne '0') { $leading0 = 0; }
$es = $es . $c unless $leading0 && $c eq '0';
if ($c eq '+' || $c eq '-') { $leading0 = 1; }
}
my $fi = substr $es, 0, 1;
my $la = substr $es, -1;
next if $fi eq '+' || $fi eq '-';
next if $la eq '+' || $la eq '-';
my $cand = eval $es;
$ma = $cand if $ma < $cand;
}
print "$ma\n";
moti