結果

問題 No.104 国道
ユーザー Syuutaro
提出日時 2018-03-15 17:45:35
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 1 ms / 5,000 ms
コード長 378 bytes
コンパイル時間 104 ms
コンパイル使用メモリ 22,272 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-12-17 19:41:17
合計ジャッジ時間 822 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 16
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:5:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    5 |     scanf("%s",S);
      |     ~~~~~^~~~~~~~

ソースコード

diff #

#include <stdio.h>
int main(){
    //iuput
    char S[30+1];
    scanf("%s",S);

    //search load
    int cLoad = 1;
    for (int i = 0;i < 30+1;i++){
        if (S[i] != '\0'){
            if (S[i] == 'L') cLoad = 2*cLoad;
            if (S[i] == 'R') cLoad = 2*cLoad+1;
        }else{
            break;
        }
    }

    //ouput
    printf("%d\n",cLoad);
    return 0;
}
0