結果
| 問題 | 
                            No.104 国道
                             | 
                    
| コンテスト | |
| ユーザー | 
                             kongarishisyamo
                         | 
                    
| 提出日時 | 2016-03-03 23:16:52 | 
| 言語 | C++11(廃止可能性あり)  (gcc 13.3.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 445 bytes | 
| コンパイル時間 | 649 ms | 
| コンパイル使用メモリ | 60,328 KB | 
| 実行使用メモリ | 6,944 KB | 
| 最終ジャッジ日時 | 2024-09-24 13:58:38 | 
| 合計ジャッジ時間 | 1,283 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge2 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 WA * 1 | 
| other | AC * 16 | 
ソースコード
#include<iostream>
#include<string>
#include<cmath>
using namespace std;
#define NMAX 1000000
int main(){
	string S="";
	long long ans;
	long long pos;
	long long bmax,nmax;
	while(cin>>S);
	if(S.size()==0) cout<<"1"<<endl;
	else{
		if(S[0]=='R') ans=3;
		else ans=2;
		for(int i=1;i<S.size();i++){
			bmax=pow(2.0,i)-1;
			nmax=pow(2.0,i+1)-1;
			pos=ans-bmax;
			ans=nmax+1+2*(pos-1);
			if(S[i]=='R') ans++;
		}
	}
	cout<<ans<<endl;
}
            
            
            
        
            
kongarishisyamo