結果

問題 No.104 国道
ユーザー Yang33
提出日時 2016-01-03 21:13:02
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 324 bytes
コンパイル時間 391 ms
コンパイル使用メモリ 54,492 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-19 10:57:31
合計ジャッジ時間 1,087 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 16
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:10:14: warning: ignoring return value of ‘char* fgets(char*, int, FILE*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   10 |         fgets(rl, 256, stdin);
      |         ~~~~~^~~~~~~~~~~~~~~~

ソースコード

diff #

#include<iostream>
#include<string.h>
using namespace std;

int main(void)
{
	long long int i, len;
	long long ans = 1;
	char rl[256];
	fgets(rl, 256, stdin);

	len = strlen(rl) - 1;

	for (i = 0; i < len; i++) {
		if (rl[i] == 'L') {
			ans *= 2;
		}
		else {
			ans = ans * 2 + 1;
		}
	}
	cout << ans << endl;
	return 0;
}
0