結果

問題 No.39 桁の数字を入れ替え
ユーザー kuroi_13kuroi_13
提出日時 2017-03-30 14:12:16
言語 Perl
(5.38.2)
結果
WA  
実行時間 -
コード長 354 bytes
コンパイル時間 349 ms
コンパイル使用メモリ 5,216 KB
実行使用メモリ 5,124 KB
最終ジャッジ日時 2023-09-21 08:40:38
合計ジャッジ時間 1,397 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 4 ms
4,900 KB
testcase_01 AC 5 ms
5,060 KB
testcase_02 AC 5 ms
4,952 KB
testcase_03 AC 5 ms
4,892 KB
testcase_04 AC 5 ms
4,960 KB
testcase_05 AC 5 ms
4,952 KB
testcase_06 AC 5 ms
4,840 KB
testcase_07 AC 5 ms
4,896 KB
testcase_08 AC 5 ms
4,824 KB
testcase_09 AC 5 ms
4,888 KB
testcase_10 AC 5 ms
4,888 KB
testcase_11 AC 5 ms
4,964 KB
testcase_12 WA -
testcase_13 AC 5 ms
5,024 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.pl syntax OK

ソースコード

diff #

use strict;
use warnings;

my $n = <>;
my $l = length $n; $l--;
my @num = $n =~ /./g;

my $swp;
my @ans;
for my $i (0..$l-1){
  for my $j ($i+1..$l){
    $swp = $num[$i];
    $num[$i] = $num[$j];
    $num[$j] = $swp;
    push @ans, join('', @num);
    $swp = $num[$i];
    $num[$i] = $num[$j];
    $num[$j] = $swp;
  }
}
print+(sort {$b <=> $a} @ans)[0];
0