結果
問題 | No.104 国道 |
ユーザー | YamaKasa |
提出日時 | 2018-04-24 03:56:06 |
言語 | Java21 (openjdk 21) |
結果 |
WA
|
実行時間 | - |
コード長 | 622 bytes |
コンパイル時間 | 2,073 ms |
コンパイル使用メモリ | 72,752 KB |
実行使用メモリ | 57,904 KB |
最終ジャッジ日時 | 2023-09-09 23:22:57 |
合計ジャッジ時間 | 5,785 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 121 ms
55,980 KB |
testcase_01 | AC | 123 ms
55,852 KB |
testcase_02 | WA | - |
testcase_03 | AC | 122 ms
55,884 KB |
testcase_04 | AC | 123 ms
56,148 KB |
testcase_05 | AC | 124 ms
55,896 KB |
testcase_06 | AC | 123 ms
56,180 KB |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | AC | 123 ms
55,612 KB |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | AC | 121 ms
55,680 KB |
testcase_19 | WA | - |
ソースコード
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); String s = scan.nextLine(); scan.close(); if(s.length() == 0) { System.out.println("1"); System.exit(0); } int l = s.length(); int h = (int)Math.pow(2, l); int k = 0; for(int i = 0; i < l; i++) { if(s.substring(i, i + 1).equals("R")) { if(k == 0) { k = 1; }else { k = (int)Math.pow(2, k) + 1; } }else { if(k == 0) { k = 0; }else { k = (int)Math.pow(2, k); } } } int ans = k + h; System.out.println(ans); } }