結果

問題 No.104 国道
ユーザー jin128
提出日時 2016-08-29 15:54:24
言語 C90
(gcc 12.3.0)
結果
RE  
実行時間 -
コード長 344 bytes
コンパイル時間 213 ms
コンパイル使用メモリ 20,864 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-11-14 06:46:42
合計ジャッジ時間 2,559 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 1 RE * 3
other WA * 1 RE * 15
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:13:12: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long unsigned int’ [-Wformat=]
   13 |   printf("%d\n", sizeof s);
      |           ~^     ~~~~~~~~
      |            |     |
      |            int   long unsigned int
      |           %ld

ソースコード

diff #

#include <stdio.h>

int main(){
  char s[30];
  int route = 1;
  int i;
  char c;

  for (i = 0; (c = getchar()) != '\n'; i++) {
  	s[i] = c;
  }

  printf("%d\n", sizeof s);
  for(i = 0; s[i] != '\n'; i++){
    if(s[i] == 'L'){
      route *= 2;
    }else{
      route *= 2;
      route += 1;
    }
  }

  printf("%d\n", route);
  return 0;
}
0