結果
問題 | No.170 スワップ文字列(Easy) |
ユーザー |
![]() |
提出日時 | 2015-04-01 00:24:10 |
言語 | Perl (5.40.0) |
結果 |
AC
|
実行時間 | 7 ms / 5,000 ms |
コード長 | 390 bytes |
コンパイル時間 | 181 ms |
コンパイル使用メモリ | 6,688 KB |
実行使用メモリ | 6,144 KB |
最終ジャッジ日時 | 2024-12-23 00:21:39 |
合計ジャッジ時間 | 1,188 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 |
コンパイルメッセージ
Main.pl syntax OK
ソースコード
#!/usr/bin/perl use strict; use warnings; my $str = <>; chomp $str; my @array = split //, $str; my $ans = 1; my $word = length $str; for(my $i = 1; $i < $word + 1; $i++) { $ans *= $i } for(my $i = 0; $i < $word - 1; $i++) { my $count = 1; for(my $j = $i + 1; $j < $word; $j++) { if($array[$i] eq $array[$j]) { $count++; } } $ans /= $count; } $ans--; print "$ans\n"; exit;