結果

問題 No.729 文字swap
ユーザー papinianuspapinianus
提出日時 2021-06-03 01:31:59
言語 PHP
(8.3.4)
結果
AC  
実行時間 38 ms / 2,000 ms
コード長 315 bytes
コンパイル時間 65 ms
コンパイル使用メモリ 30,980 KB
実行使用メモリ 31,524 KB
最終ジャッジ日時 2024-04-27 17:14:24
合計ジャッジ時間 1,095 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 33 ms
31,000 KB
testcase_01 AC 32 ms
31,416 KB
testcase_02 AC 33 ms
30,920 KB
testcase_03 AC 33 ms
31,524 KB
testcase_04 AC 35 ms
30,896 KB
testcase_05 AC 35 ms
31,344 KB
testcase_06 AC 36 ms
31,296 KB
testcase_07 AC 38 ms
31,156 KB
testcase_08 AC 33 ms
31,208 KB
testcase_09 AC 34 ms
31,068 KB
testcase_10 AC 34 ms
31,244 KB
testcase_11 AC 35 ms
30,884 KB
testcase_12 AC 35 ms
31,064 KB
testcase_13 AC 34 ms
31,464 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
No syntax errors detected in Main.php

ソースコード

diff #

<?php
declare(strict_types=1);
$S = str_split(trim(fgets(STDIN)));
[$i,$j] = array_map(fn($e)=>intval($e), explode(" ", trim(fgets(STDIN))));
$converted = [];
foreach ($S as $pos => $char) {
    $converted[] = ($pos === $i) ? $S[$j] : (($pos === $j) ? $S[$i] : $char);
}
echo implode("", $converted);
echo PHP_EOL;
0