結果
問題 | No.104 国道 |
ユーザー | A A |
提出日時 | 2024-03-12 23:05:28 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 29 ms / 5,000 ms |
コード長 | 532 bytes |
コンパイル時間 | 131 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 10,624 KB |
最終ジャッジ日時 | 2024-09-29 22:27:37 |
合計ジャッジ時間 | 1,531 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 16 |
ソースコード
def get_current_highway(S): current_highway = 1 # 最初は1号線からスタート for direction in S: if direction == 'L': current_highway *= 2 # 左に移動するときは国道番号を2倍にする else: current_highway = current_highway * 2 + 1 # 右に移動するときは国道番号を2倍にして1を加える return current_highway # 入力を受け取る S = input().strip() # 現在の国道番号を求める result = get_current_highway(S) print(result)