結果
| 問題 | No.104 国道 |
| コンテスト | |
| ユーザー |
kongarishisyamo
|
| 提出日時 | 2016-03-03 23:19:06 |
| 言語 | C++11 (gcc 15.3.0 + boost 1.92.0) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 5,000 ms |
| + 380µs | |
| コード長 | 446 bytes |
| 記録 | |
| コンパイル時間 | 310 ms |
| コンパイル使用メモリ | 79,696 KB |
| 実行使用メモリ | 9,736 KB |
| 最終ジャッジ日時 | 2026-09-03 06:53:18 |
| 合計ジャッジ時間 | 1,506 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| 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