結果
| 問題 | No.104 国道 |
| コンテスト | |
| ユーザー |
kongarishisyamo
|
| 提出日時 | 2016-03-03 23:16:09 |
| 言語 | C++11 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 434 bytes |
| 記録 | |
| コンパイル時間 | 345 ms |
| コンパイル使用メモリ | 79,504 KB |
| 実行使用メモリ | 7,972 KB |
| 最終ジャッジ日時 | 2026-04-11 18:04:46 |
| 合計ジャッジ時間 | 1,266 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 WA * 1 |
| other | AC * 16 |
コンパイルメッセージ
In file included from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/ostream:42,
from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/iostream:43,
from main.cpp:1:
In member function 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with _CharT = char; _Traits = std::char_traits<char>]',
inlined from 'int main()' at main.cpp:30:8:
/home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/bits/ostream.h:212:25: warning: 'ans' may be used uninitialized [-Wmaybe-uninitialized]
212 | { return _M_insert(__n); }
| ~~~~~~~~~^~~~~
main.cpp: In function 'int main()':
main.cpp:12:19: note: 'ans' was declared here
12 | long long ans;
| ^~~
ソースコード
#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;
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