結果

問題 No.104 国道
コンテスト
ユーザー Fre_de_rica
提出日時 2019-03-08 16:17:58
言語 C(gnu17)
(gcc 15.2.0)
コンパイル:
gcc-15 -O2 -std=gnu17 -Wno-error=implicit-function-declaration -Wno-error=implicit-int -Wno-error=incompatible-pointer-types -Wno-error=int-conversion -DONLINE_JUDGE -o a.out _filename_ -lm
実行:
./a.out
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 616 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 235 ms
コンパイル使用メモリ 38,080 KB
最終ジャッジ日時 2026-02-22 02:33:31
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 13 WA * 3
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#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