結果

問題 No.104 国道
ユーザー kichirb3
提出日時 2018-02-28 22:59:43
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 454 bytes
コンパイル時間 478 ms
コンパイル使用メモリ 65,488 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-12-22 23:53:54
合計ジャッジ時間 1,383 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

// No.104 国道
// https://yukicoder.me/problems/no/104
//
#include <iostream>
using namespace std;

unsigned int solve(string &S);


int main() {
    string S;
    cin >> S;
    unsigned int ans = solve(S);
    cout << ans << endl;
}

unsigned int solve(string &S) {
    unsigned int road_num = 1;
    for (char s: S) {
        if (s == 'L')
            road_num *= 2;
        else
            road_num = road_num * 2 + 1;
    }
    return road_num;
}
0