結果

問題 No.104 国道
ユーザー Pictogram1010
提出日時 2016-07-20 16:30:14
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 287 bytes
コンパイル時間 396 ms
コンパイル使用メモリ 53,804 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-10-15 17:36:21
合計ジャッジ時間 1,137 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 16
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:9:14: warning: ignoring return value of ‘char* fgets(char*, int, FILE*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    9 |         fgets(s, sizeof(s), stdin);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include<iostream>
#include<stdio.h>

using namespace std;

int main()
{
	char s[31];
	fgets(s, sizeof(s), stdin);

	int RoNum = 1;

	for (int i = 0; s[i] != '\0'; i++){
		if (s[i] == 'L')
			RoNum *= 2;
		else if (s[i] == 'R')
			RoNum = (RoNum * 2) + 1;
	}

	cout << RoNum << endl;
	
}
0