結果
| 問題 | No.104 国道 |
| コンテスト | |
| ユーザー |
37zigen
|
| 提出日時 | 2016-04-01 03:43:04 |
| 言語 | Java (openjdk 26.0.2.1 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 59 ms / 5,000 ms |
| + 694µs | |
| コード長 | 748 bytes |
| 記録 | |
| コンパイル時間 | 1,389 ms |
| コンパイル使用メモリ | 85,528 KB |
| 実行使用メモリ | 45,116 KB |
| 最終ジャッジ日時 | 2026-09-08 19:05:52 |
| 合計ジャッジ時間 | 4,098 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 16 |
ソースコード
package yukicoder104;
import java.util.Scanner;
public class Main {
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
String str=sc.nextLine();
int low=1;
int upper=(int)Math.pow(2,str.length());
for(int i=0;i<str.length();i++){
if(str.charAt(i)=='L'){
upper=(upper+low)/2;
// System.err.println("upper"+upper);
// System.err.println("low"+low);
}else if(str.charAt(i)=='R'){
low=(upper+low)/2+1;
// System.err.println("upper"+upper);
// System.err.println("low"+low);
}
}
if(low!=upper){
System.err.println("error");
}
if(str.length()>=1){
System.out.println((int)Math.pow(2, str.length())-1+low);
}else if(str.length()==0){
System.out.println(1);
}
}
}
37zigen