結果
問題 | No.400 鏡 |
ユーザー |
![]() |
提出日時 | 2021-03-01 23:58:26 |
言語 | TypeScript (5.7.2) |
結果 |
AC
|
実行時間 | 62 ms / 2,000 ms |
コード長 | 662 bytes |
コンパイル時間 | 7,642 ms |
コンパイル使用メモリ | 229,316 KB |
実行使用メモリ | 39,424 KB |
最終ジャッジ日時 | 2024-12-31 16:31:16 |
合計ジャッジ時間 | 9,088 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 8 |
ソースコード
import * as fs from 'fs'; const input = fs.readFileSync('/dev/stdin', 'utf8'); const nlarray = input.split('\n'); //1文字ずつ分割して格納 const array = nlarray[0].split(''); //文字列を反転させる(インデックスを反転させる) let coordinate_array = []; for (let i = array.length - 1; i >= 0; i--) { coordinate_array.push(array[i]); } //<を>に、>を<に置換する処理 for (let j = 0; j < coordinate_array.length; j++) { if (coordinate_array[j] === '<') { coordinate_array[j] = '>'; } else if (coordinate_array[j] === '>') { coordinate_array[j] = '<'; } } console.log(coordinate_array.join(''));