結果

問題 No.104 国道
ユーザー megane_anko
提出日時 2021-02-22 04:50:14
言語 TypeScript
(5.7.2)
結果
AC  
実行時間 66 ms / 5,000 ms
コード長 441 bytes
コンパイル時間 8,782 ms
コンパイル使用メモリ 229,124 KB
実行使用メモリ 39,424 KB
最終ジャッジ日時 2024-12-31 16:28:48
合計ジャッジ時間 10,242 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

import * as fs from 'fs';
const input = fs.readFileSync('/dev/stdin', 'utf8');

const arr1 = input.split('\n');
let N = arr1[0].length;
//console.log(N);
const arr2 = arr1[0].split('');
let result = 1;

for (let i = 0; i <= N; i++) {
    if (arr2[i] === "L") {
        result = 2 * result;
        //console.log("L");
    } else if (arr2[i] === "R") {
        result = 2 * result + 1;
        //console.log("R");
    }
}
console.log(result);
0