結果

問題 No.193 筒の数式
ユーザー motimoti
提出日時 2018-05-24 02:04:57
言語 Perl
(5.38.2)
結果
WA  
実行時間 -
コード長 637 bytes
コンパイル時間 106 ms
コンパイル使用メモリ 6,132 KB
実行使用メモリ 6,368 KB
最終ジャッジ日時 2023-09-11 02:11:16
合計ジャッジ時間 1,290 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 14 ms
6,096 KB
testcase_03 AC 14 ms
6,256 KB
testcase_04 AC 14 ms
6,104 KB
testcase_05 AC 14 ms
6,116 KB
testcase_06 AC 14 ms
6,088 KB
testcase_07 AC 14 ms
6,116 KB
testcase_08 AC 14 ms
6,180 KB
testcase_09 AC 14 ms
6,152 KB
testcase_10 AC 14 ms
6,352 KB
testcase_11 AC 14 ms
6,340 KB
testcase_12 AC 14 ms
6,324 KB
testcase_13 AC 14 ms
6,160 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.pl syntax OK

ソースコード

diff #

#!/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";
0