結果
問題 | No.219 巨大数の概算 |
ユーザー | uafr_cs |
提出日時 | 2015-08-31 04:04:07 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 565 ms / 1,500 ms |
コード長 | 1,532 bytes |
コンパイル時間 | 2,213 ms |
コンパイル使用メモリ | 85,032 KB |
実行使用メモリ | 57,036 KB |
最終ジャッジ日時 | 2024-07-18 11:37:22 |
合計ジャッジ時間 | 30,309 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 545 ms
56,284 KB |
testcase_01 | AC | 529 ms
48,628 KB |
testcase_02 | AC | 540 ms
48,712 KB |
testcase_03 | AC | 532 ms
56,428 KB |
testcase_04 | AC | 535 ms
56,296 KB |
testcase_05 | AC | 152 ms
42,684 KB |
testcase_06 | AC | 286 ms
45,332 KB |
testcase_07 | AC | 159 ms
42,472 KB |
testcase_08 | AC | 290 ms
45,404 KB |
testcase_09 | AC | 156 ms
42,648 KB |
testcase_10 | AC | 519 ms
48,728 KB |
testcase_11 | AC | 540 ms
56,492 KB |
testcase_12 | AC | 516 ms
48,556 KB |
testcase_13 | AC | 519 ms
48,648 KB |
testcase_14 | AC | 525 ms
54,752 KB |
testcase_15 | AC | 534 ms
54,940 KB |
testcase_16 | AC | 503 ms
48,724 KB |
testcase_17 | AC | 510 ms
55,808 KB |
testcase_18 | AC | 510 ms
56,092 KB |
testcase_19 | AC | 527 ms
56,276 KB |
testcase_20 | AC | 507 ms
56,356 KB |
testcase_21 | AC | 506 ms
55,048 KB |
testcase_22 | AC | 522 ms
48,036 KB |
testcase_23 | AC | 514 ms
55,224 KB |
testcase_24 | AC | 526 ms
55,472 KB |
testcase_25 | AC | 514 ms
48,468 KB |
testcase_26 | AC | 528 ms
48,144 KB |
testcase_27 | AC | 538 ms
48,396 KB |
testcase_28 | AC | 522 ms
56,212 KB |
testcase_29 | AC | 532 ms
56,404 KB |
testcase_30 | AC | 524 ms
48,580 KB |
testcase_31 | AC | 518 ms
48,528 KB |
testcase_32 | AC | 525 ms
56,868 KB |
testcase_33 | AC | 541 ms
57,036 KB |
testcase_34 | AC | 532 ms
48,700 KB |
testcase_35 | AC | 532 ms
55,460 KB |
testcase_36 | AC | 510 ms
55,024 KB |
testcase_37 | AC | 565 ms
48,536 KB |
testcase_38 | AC | 530 ms
48,368 KB |
testcase_39 | AC | 538 ms
56,448 KB |
testcase_40 | AC | 533 ms
48,664 KB |
testcase_41 | AC | 504 ms
55,080 KB |
testcase_42 | AC | 541 ms
48,436 KB |
testcase_43 | AC | 559 ms
48,612 KB |
testcase_44 | AC | 537 ms
48,316 KB |
testcase_45 | AC | 521 ms
56,932 KB |
testcase_46 | AC | 520 ms
48,276 KB |
testcase_47 | AC | 516 ms
48,664 KB |
testcase_48 | AC | 505 ms
48,312 KB |
testcase_49 | AC | 530 ms
56,320 KB |
testcase_50 | AC | 563 ms
48,472 KB |
testcase_51 | AC | 139 ms
42,520 KB |
ソースコード
import java.io.BufferedReader; import java.io.Closeable; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.math.BigDecimal; import java.math.BigInteger; import java.util.Arrays; import java.util.HashSet; import java.util.LinkedList; import java.util.NoSuchElementException; import java.util.Scanner; import java.util.Set; import java.util.StringTokenizer; public class Main { public static void main(String[] args) throws IOException{ Scanner sc = new Scanner(System.in); final int N = (int)(sc.nextLong()); for(int tt = 0; tt < N; tt++){ final long A = sc.nextLong(); final long B = sc.nextLong(); final double upper = B * Math.log10(A); double diff = Double.MAX_VALUE; long min_diff_X = 0, min_diff_Y = 0, min_diff_Z = 0; for(int X = 1; X < 10; X++){ for(int Y = 0; Y < 10; Y++){ final double lower = Math.log10(10 * X + Y); final long Z = (long)(upper - lower); final double restore_upper = Z + lower; //System.out.println(upper + " " + Z + " " + restore_upper); if(diff > Math.abs(upper - restore_upper)){ //System.out.println(upper + " " + restore_upper); //System.out.println(X + " " + Y + " " + Z + " " + (upper - restore_upper)); diff = Math.abs(upper - restore_upper); min_diff_X = X; min_diff_Y = Y; min_diff_Z = Z; } } } System.out.println(min_diff_X + " " + min_diff_Y + " " + (min_diff_Z + 1)); } } }