結果

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

ソースコード

diff #

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

int main(void){
    
    int current_root = 1;
    char root_hist[31];
    char *p;
    
    scanf("%s", root_hist);
    
    p = root_hist;
    
    while(!isdigit(*p)){
        
        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