結果

問題 No.220 世界のなんとか2
ユーザー mobius_bkstmobius_bkst
提出日時 2015-05-31 11:16:32
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 573 bytes
コンパイル時間 3,556 ms
コンパイル使用メモリ 72,460 KB
実行使用メモリ 49,808 KB
最終ジャッジ日時 2023-09-20 17:57:30
合計ジャッジ時間 5,300 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
49,004 KB
testcase_01 AC 42 ms
49,216 KB
testcase_02 AC 42 ms
49,240 KB
testcase_03 AC 43 ms
49,128 KB
testcase_04 AC 41 ms
49,376 KB
testcase_05 AC 43 ms
49,396 KB
testcase_06 AC 42 ms
49,308 KB
testcase_07 AC 44 ms
49,592 KB
testcase_08 AC 43 ms
49,464 KB
testcase_09 AC 43 ms
49,128 KB
testcase_10 AC 42 ms
49,188 KB
testcase_11 AC 42 ms
49,176 KB
testcase_12 AC 43 ms
49,104 KB
testcase_13 AC 42 ms
49,180 KB
testcase_14 AC 42 ms
49,800 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader;
import java.io.InputStreamReader;

public class No220_2 {
    public static void main(String[] args) {
        try {
            BufferedReader br = new BufferedReader(new InputStreamReader(
                    System.in));
            int N = Integer.parseInt(br.readLine());

            // 10^n-1-(2/3)×9^n
            long ans = (long) (Math.pow(10, N) - 1 - (2 / 3.0) * Math.pow(9, N));
            System.out.println(ans);
        } catch (Exception e) {
            System.err.println("Error:" + e.getMessage());
        }
    }
}
0