結果
問題 |
No.81 すべて足すだけの簡単なお仕事です。
|
ユーザー |
|
提出日時 | 2020-03-22 04:57:20 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 150 ms / 5,000 ms |
コード長 | 909 bytes |
コンパイル時間 | 2,814 ms |
コンパイル使用メモリ | 87,676 KB |
実行使用メモリ | 42,108 KB |
最終ジャッジ日時 | 2024-07-22 16:49:08 |
合計ジャッジ時間 | 7,509 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 30 |
ソースコード
import java.io.FileNotFoundException; import java.math.BigDecimal; import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] args) throws FileNotFoundException { long t = System.currentTimeMillis(); new Main().run(); System.err.println(System.currentTimeMillis() - t); } void run() { Scanner sc = new Scanner(System.in); int N=sc.nextInt(); BigDecimal ret=new BigDecimal(0); for(int i=0;i<N;++i) { BigDecimal a=new BigDecimal(sc.next()); ret=ret.add(a); } String str=ret.toString(); int p=0; while(p<str.length()&&str.charAt(p)!='.')++p; if(p!=str.length()) { int n=str.length(); for(int i=0;i<10-(n-1-p);++i) str=str+"0"; }else { str=str+"."; for(int i=0;i<10;++i)str=str+"0"; } System.out.println(str); } static void tr(Object... objects) { System.out.println(Arrays.deepToString(objects)); } }