結果

問題 No.104 国道
ユーザー dai11dai11
提出日時 2017-08-03 09:47:03
言語 C++11
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 429 bytes
コンパイル時間 1,285 ms
コンパイル使用メモリ 157,020 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-11 20:20:32
合計ジャッジ時間 2,037 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 16
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main(int, char**)’:
main.cpp:11:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   11 |   scanf("%s",a);
      |   ~~~~~^~~~~~~~

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

int main(int argc, char **argv)
{
  int counter = 1;  //カウンタ
  int i;            //ループカウンタ
  char a[1000];     //文字列
  
  scanf("%s",a);
  
  for(i = 0;i < strlen(a);i++)
  {
    if('L' == a[i])
    {
      counter = counter * 2;
    }
    else if('R' == a[i])
    {
      counter = (counter * 2) + 1;
    }
  }

  printf("%d\n",counter);

  return 0;
}
0