結果
| 問題 |
No.104 国道
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-10-24 15:53:05 |
| 言語 | Java (openjdk 23) |
| 結果 |
AC
|
| 実行時間 | 48 ms / 5,000 ms |
| コード長 | 656 bytes |
| コンパイル時間 | 3,087 ms |
| コンパイル使用メモリ | 73,132 KB |
| 実行使用メモリ | 40,812 KB |
| 最終ジャッジ日時 | 2024-11-21 17:38:12 |
| 合計ジャッジ時間 | 4,804 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 16 |
ソースコード
import java.io.*;
public class No104{
public static void main(String[] args) throws IOException{
String str = new BufferedReader(new InputStreamReader(System.in)).readLine();
if(str == null){
System.out.println(1);
return;
}
else{
char[] direction = str.toCharArray();
long roadNum = 1;
System.out.println(calc(roadNum, direction));
}
}
public static long calc(long a, char[] b){
for(int i=0; i < b.length; i++){
if(b[i] == 'R') a = (a * 2) + 1;
if(b[i] == 'L') a *= 2;
}
return a;
}
}