結果

問題 No.104 国道
ユーザー yukiteru
提出日時 2017-10-22 13:42:32
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 641 bytes
コンパイル時間 760 ms
コンパイル使用メモリ 77,548 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-21 13:45:06
合計ジャッジ時間 1,422 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 16
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:25:13: warning: 'p' may be used uninitialized [-Wmaybe-uninitialized]
   25 |         int p;
      |             ^

ソースコード

diff #

#include<iostream>
#include<string>
#include<string.h>
#include<algorithm>
#include<stdio.h>
#include<cmath>
#include<vector>
#include<utility>
#include<stack>
#include<queue>
#include<list>
#include<bitset>

#define FOR(i, a, b) for(int i=(a);i<=(b);i++)
#define RFOR(i, a, b) for(int i=(a);i>=(b);i--)
#define MOD 1000000007
#define INF 1000000000

using namespace std;


int main(void) {
	char s[35];
	int pos = 1;
	int p;

	fgets(s,34,stdin);
	FOR(i, 0, 31) {
		if (s[i] == '\0') {
			p = i;
			break;
		}
	}
	FOR(i, 0,p-2) {
		if (s[i] == 'L') {
			pos = pos * 2;
		}
		else {
			pos = pos * 2 + 1;
		}
	}
	cout<<pos<<endl;
	return 0;
}
0