結果

問題 No.668 6.0*10^23
ユーザー takeya_okino
提出日時 2019-09-16 00:43:21
言語 Java
(openjdk 23)
結果
AC  
実行時間 232 ms / 2,000 ms
コード長 774 bytes
コンパイル時間 2,649 ms
コンパイル使用メモリ 81,176 KB
実行使用メモリ 45,060 KB
最終ジャッジ日時 2024-07-06 22:54:25
合計ジャッジ時間 13,232 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 50
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String n = sc.next();
    int d1 = Integer.parseInt(String.valueOf(n.charAt(0)));
    int d2 = Integer.parseInt(String.valueOf(n.charAt(1)));
    int d3 = Integer.parseInt(String.valueOf(n.charAt(2)));
    int keta = n.length() - 1;
    String ans = "";
    if(d3 >= 5) {
      if(d2 == 9) {
        if(d1 == 9) {
          keta++;
          ans = 1 + "." + 0 + "*10^" + keta;
        } else {
          d1++;
          ans = d1 + "." + 0 + "*10^" + keta;
        }
      } else {
        d2++;
        ans = d1 + "." + d2 + "*10^" + keta;
      }
    } else {
      ans = d1 + "." + d2 + "*10^" + keta; 
    }
    System.out.println(ans);
  }
}
0