結果
問題 | No.668 6.0*10^23 |
ユーザー |
![]() |
提出日時 | 2018-10-01 14:06:58 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 252 ms / 2,000 ms |
コード長 | 911 bytes |
コンパイル時間 | 2,397 ms |
コンパイル使用メモリ | 79,892 KB |
実行使用メモリ | 56,628 KB |
最終ジャッジ日時 | 2024-07-01 04:43:57 |
合計ジャッジ時間 | 14,424 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 50 |
ソースコード
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);}}}