結果

問題 No.104 国道
ユーザー 西尾西尾
提出日時 2018-03-09 14:37:19
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 5,000 ms
コード長 389 bytes
コンパイル時間 1,914 ms
コンパイル使用メモリ 166,156 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-08 12:52:05
合計ジャッジ時間 2,444 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main()
{
int i;
long long iPos;
long long i2;
char S[ 50 ];
char C;

	if( ! ( cin >> S ) )
	{
		cout << 1 << endl;

		return 0;
	}

	iPos = 0;
	i2 = 1;
	i = 0;
	C = S[ i ];
	while( C != '\0' )
	{
		if( C == 'L' )
			iPos *= 2;
		else
			iPos = iPos * 2 + 1;

		i2 *= 2;
		i++;
		C = S[ i ];
	}

	cout << i2 + iPos << endl;

	return 0;
}

0