結果

問題 No.668 6.0*10^23
ユーザー YamaKasaYamaKasa
提出日時 2018-10-01 14:06:58
言語 Java21
(openjdk 21)
結果
AC  
実行時間 240 ms / 2,000 ms
コード長 911 bytes
コンパイル時間 2,301 ms
コンパイル使用メモリ 76,216 KB
実行使用メモリ 58,984 KB
最終ジャッジ日時 2023-09-13 20:14:53
合計ジャッジ時間 14,344 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 132 ms
55,912 KB
testcase_01 AC 226 ms
58,740 KB
testcase_02 AC 206 ms
54,768 KB
testcase_03 AC 201 ms
57,204 KB
testcase_04 AC 214 ms
58,984 KB
testcase_05 AC 180 ms
56,756 KB
testcase_06 AC 201 ms
57,264 KB
testcase_07 AC 152 ms
57,020 KB
testcase_08 AC 152 ms
56,592 KB
testcase_09 AC 151 ms
56,864 KB
testcase_10 AC 159 ms
55,712 KB
testcase_11 AC 226 ms
58,444 KB
testcase_12 AC 175 ms
56,860 KB
testcase_13 AC 206 ms
56,544 KB
testcase_14 AC 240 ms
58,400 KB
testcase_15 AC 152 ms
55,780 KB
testcase_16 AC 152 ms
55,644 KB
testcase_17 AC 228 ms
58,636 KB
testcase_18 AC 191 ms
56,032 KB
testcase_19 AC 150 ms
56,012 KB
testcase_20 AC 206 ms
57,288 KB
testcase_21 AC 229 ms
58,836 KB
testcase_22 AC 229 ms
58,508 KB
testcase_23 AC 208 ms
57,612 KB
testcase_24 AC 170 ms
56,832 KB
testcase_25 AC 224 ms
58,344 KB
testcase_26 AC 164 ms
56,564 KB
testcase_27 AC 207 ms
57,228 KB
testcase_28 AC 226 ms
56,348 KB
testcase_29 AC 202 ms
56,908 KB
testcase_30 AC 226 ms
58,148 KB
testcase_31 AC 204 ms
56,784 KB
testcase_32 AC 169 ms
56,812 KB
testcase_33 AC 232 ms
56,648 KB
testcase_34 AC 177 ms
57,116 KB
testcase_35 AC 176 ms
56,884 KB
testcase_36 AC 218 ms
57,352 KB
testcase_37 AC 224 ms
58,692 KB
testcase_38 AC 203 ms
57,172 KB
testcase_39 AC 207 ms
55,692 KB
testcase_40 AC 228 ms
58,272 KB
testcase_41 AC 224 ms
58,164 KB
testcase_42 AC 201 ms
57,008 KB
testcase_43 AC 226 ms
58,660 KB
testcase_44 AC 210 ms
56,624 KB
testcase_45 AC 161 ms
56,708 KB
testcase_46 AC 161 ms
56,532 KB
testcase_47 AC 152 ms
57,220 KB
testcase_48 AC 153 ms
56,892 KB
testcase_49 AC 129 ms
55,896 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String N = scan.next();
		scan.close();
		int c = N.length() - 1;
		if(N.charAt(0) == '9' && N.charAt(1) == '9' && N.charAt(2) >= '5') {
			c += 1;
			System.out.println("1.0*10^" + c);
			System.exit(0);
		}
		if(N.charAt(1) == '9' && N.charAt(2) >= '5') {
			int a = Integer.parseInt(N.substring(0, 1)) + 1;
			int b = 0;
			System.out.println(a + "." + b + "*10^" + c);
			System.exit(0);
		}
		if(N.charAt(2) >= '5') {
			int a = Integer.parseInt(N.substring(0, 1));
			int b = 0;
			if(N.charAt(1) != '9') {
				b = Integer.parseInt(N.substring(1, 2)) + 1;
			}
			System.out.println(a + "." + b + "*10^" + c);
		}else {
			int a = Integer.parseInt(N.substring(0, 1));
			int b = Integer.parseInt(N.substring(1, 2));
			System.out.println(a + "." + b + "*10^" + c);
		}
	}
}
0