結果

問題 No.104 国道
ユーザー Y_S
提出日時 2020-08-08 06:14:34
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 529 bytes
コンパイル時間 721 ms
コンパイル使用メモリ 74,672 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-25 09:58:20
合計ジャッジ時間 1,466 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>	//cin, cout
#include <vector>	//vector
#include <algorithm> //sort,min,max
#include <string>	//string
#include <ios>		//fixed
#include <iomanip>	//setprecision
#include <utility> //swap
#include <cstdlib>	//abs(int)
#include <sstream>	//stringstream,getline

using namespace std;

int main() {

	string S;
	cin >> S;

	long long int ans = 1;
	for (unsigned int i = 0; i < S.length(); i++) {
		if (S[i] == 'L') {
			ans = ans * 2;
		}
		else {
			ans = ans * 2 + 1;
		}
	}

	cout << ans << endl;

	return 0;

}
0