結果

問題 No.560 ふしぎなナップサック
ユーザー tentententen
提出日時 2024-02-05 16:28:51
言語 Java21
(openjdk 21)
結果
AC  
実行時間 55 ms / 2,000 ms
コード長 1,287 bytes
コンパイル時間 2,239 ms
コンパイル使用メモリ 78,592 KB
実行使用メモリ 54,512 KB
最終ジャッジ日時 2024-02-05 16:28:55
合計ジャッジ時間 3,913 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 52 ms
54,500 KB
testcase_01 AC 52 ms
54,488 KB
testcase_02 AC 52 ms
54,496 KB
testcase_03 AC 51 ms
54,380 KB
testcase_04 AC 51 ms
54,376 KB
testcase_05 AC 55 ms
54,496 KB
testcase_06 AC 52 ms
54,504 KB
testcase_07 AC 53 ms
54,488 KB
testcase_08 AC 52 ms
54,476 KB
testcase_09 AC 52 ms
54,504 KB
testcase_10 AC 53 ms
54,496 KB
testcase_11 AC 52 ms
54,512 KB
testcase_12 AC 52 ms
54,496 KB
testcase_13 AC 55 ms
54,512 KB
testcase_14 AC 52 ms
54,508 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;
import java.util.*;
import java.util.function.*;
import java.util.stream.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner();
        double m = sc.nextInt();
        int n = sc.nextInt();
        while (n-- > 0) {
            m = m * 2 / 3 + (m + 1) / 3;
        }
        System.out.println(new java.math.BigDecimal(m).toPlainString());
    }
}
class Scanner {
    BufferedReader br;
    StringTokenizer st = new StringTokenizer("");
    StringBuilder sb = new StringBuilder();
    
    public Scanner() {
        try {
            br = new BufferedReader(new InputStreamReader(System.in));
        } catch (Exception e) {
            
        }
    }
    
    public int nextInt() {
        return Integer.parseInt(next());
    }
    
    public long nextLong() {
        return Long.parseLong(next());
    }
    
    public double nextDouble() {
        return Double.parseDouble(next());
    }
    
    public String next() {
        try {
            while (!st.hasMoreTokens()) {
                st = new StringTokenizer(br.readLine());
            }
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            return st.nextToken();
        }
    }
    
}
0