結果

問題 No.219 巨大数の概算
ユーザー GrenacheGrenache
提出日時 2015-05-29 22:59:57
言語 Java21
(openjdk 21)
結果
AC  
実行時間 570 ms / 1,500 ms
コード長 807 bytes
コンパイル時間 3,511 ms
コンパイル使用メモリ 73,092 KB
実行使用メモリ 68,352 KB
最終ジャッジ日時 2023-09-25 13:41:01
合計ジャッジ時間 33,920 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 563 ms
66,852 KB
testcase_01 AC 549 ms
67,080 KB
testcase_02 AC 567 ms
66,848 KB
testcase_03 AC 531 ms
67,488 KB
testcase_04 AC 519 ms
64,184 KB
testcase_05 AC 171 ms
57,104 KB
testcase_06 AC 335 ms
60,036 KB
testcase_07 AC 175 ms
56,808 KB
testcase_08 AC 333 ms
60,044 KB
testcase_09 AC 171 ms
57,136 KB
testcase_10 AC 561 ms
66,788 KB
testcase_11 AC 529 ms
67,272 KB
testcase_12 AC 552 ms
66,260 KB
testcase_13 AC 540 ms
66,068 KB
testcase_14 AC 548 ms
64,696 KB
testcase_15 AC 551 ms
67,260 KB
testcase_16 AC 551 ms
67,364 KB
testcase_17 AC 533 ms
65,980 KB
testcase_18 AC 539 ms
63,392 KB
testcase_19 AC 536 ms
68,132 KB
testcase_20 AC 531 ms
67,536 KB
testcase_21 AC 545 ms
63,416 KB
testcase_22 AC 564 ms
65,168 KB
testcase_23 AC 547 ms
67,220 KB
testcase_24 AC 559 ms
67,096 KB
testcase_25 AC 547 ms
67,564 KB
testcase_26 AC 551 ms
67,588 KB
testcase_27 AC 531 ms
67,116 KB
testcase_28 AC 540 ms
66,300 KB
testcase_29 AC 536 ms
67,136 KB
testcase_30 AC 550 ms
66,328 KB
testcase_31 AC 539 ms
66,280 KB
testcase_32 AC 553 ms
62,220 KB
testcase_33 AC 559 ms
65,340 KB
testcase_34 AC 570 ms
66,660 KB
testcase_35 AC 564 ms
66,848 KB
testcase_36 AC 558 ms
66,060 KB
testcase_37 AC 556 ms
61,788 KB
testcase_38 AC 544 ms
66,020 KB
testcase_39 AC 539 ms
67,404 KB
testcase_40 AC 551 ms
63,848 KB
testcase_41 AC 547 ms
65,900 KB
testcase_42 AC 560 ms
65,296 KB
testcase_43 AC 559 ms
68,352 KB
testcase_44 AC 557 ms
67,436 KB
testcase_45 AC 559 ms
60,316 KB
testcase_46 AC 549 ms
64,684 KB
testcase_47 AC 559 ms
65,940 KB
testcase_48 AC 552 ms
66,340 KB
testcase_49 AC 554 ms
65,720 KB
testcase_50 AC 559 ms
65,988 KB
testcase_51 AC 167 ms
57,004 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;


public class Main_yukicoder219 {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();

		for (int i = 0; i < n; i++) {
			long a = sc.nextLong();
			long b = sc.nextLong();

			long loop = b;
			double x = a;
			long xlg = 0;
			while (x >= 10) {
				x /= 10;
				xlg++;
			}
			double xy = 1.0;
			long xylg = 0;
			while (loop > 0) {
				if (loop % 2 == 1) {
					xy = xy * x;
					xylg += xlg;

				}
				x = x * x;
				xlg += xlg;
				while (x >= 10) {
					x /= 10;
					xlg++;
				}
				loop /= 2;
			}

			while (xy >= 100) {
				xy /= 10;
				xylg++;
			}
			while (xy < 10) {
				xy *= 10;
				xylg--;
			}
			
			System.out.println((int)(xy / 10) + " " + (int)xy % 10 + " " + (xylg + 1));
		}
		
		sc.close();
	}
}
0