結果

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

ソースコード

diff #

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>


int main(int argc, char *argv[])
{
	char S[32] = "";

	scanf("%s", S);

	int N = strlen(S);
	int X = 1;

	for (int i = 0; i < N; i++)
	{
		if (S[i] == 'L')
		{
			X *= 2;
		}
		else
		{
			X = X * 2 + 1;
		}

	}
	printf("%d\n", X);


	return 0;

}

0