結果

問題 No.104 国道
ユーザー Fre_de_rica
提出日時 2019-03-08 16:03:50
言語 C
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 595 bytes
コンパイル時間 120 ms
コンパイル使用メモリ 29,056 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-06-23 15:02:29
合計ジャッジ時間 2,452 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 1 RE * 1
other AC * 6 RE * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <string.h>

int main(void){
    
    int current_root = 1;
    char root_hist[31];
    char *p;
    
    scanf("%s", root_hist);
    
    p = root_hist;
    
    while(*p != '\n'){
        
        if(*p == 'L'){
            current_root = current_root*2;
        }
        if(*p == 'R'){
            current_root = current_root*2+1;
        }
        /* debug
        if(current_root == 114){
            printf("514");
        }
        if(current_root == 810){
            printf("1919");
        }
        */
        p++;
    }
    printf("%d\n", current_root);
}
0