結果

問題 No.81 すべて足すだけの簡単なお仕事です。
ユーザー リチウムリチウム
提出日時 2014-11-27 23:55:09
言語 Java19
(openjdk 21)
結果
AC  
実行時間 173 ms / 5,000 ms
コード長 712 bytes
コンパイル時間 3,083 ms
コンパイル使用メモリ 73,392 KB
実行使用メモリ 40,540 KB
最終ジャッジ日時 2023-09-29 22:25:09
合計ジャッジ時間 9,534 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 126 ms
39,760 KB
testcase_01 AC 131 ms
39,780 KB
testcase_02 AC 131 ms
40,072 KB
testcase_03 AC 129 ms
39,776 KB
testcase_04 AC 173 ms
40,300 KB
testcase_05 AC 141 ms
40,004 KB
testcase_06 AC 163 ms
40,152 KB
testcase_07 AC 148 ms
40,236 KB
testcase_08 AC 154 ms
40,420 KB
testcase_09 AC 166 ms
40,528 KB
testcase_10 AC 135 ms
39,980 KB
testcase_11 AC 141 ms
40,012 KB
testcase_12 AC 141 ms
40,136 KB
testcase_13 AC 125 ms
39,540 KB
testcase_14 AC 124 ms
39,548 KB
testcase_15 AC 144 ms
40,044 KB
testcase_16 AC 127 ms
40,308 KB
testcase_17 AC 125 ms
39,932 KB
testcase_18 AC 153 ms
39,924 KB
testcase_19 AC 132 ms
39,936 KB
testcase_20 AC 127 ms
39,988 KB
testcase_21 AC 125 ms
39,724 KB
testcase_22 AC 132 ms
39,676 KB
testcase_23 AC 162 ms
40,540 KB
testcase_24 AC 141 ms
39,860 KB
testcase_25 AC 126 ms
40,308 KB
testcase_26 AC 127 ms
39,676 KB
testcase_27 AC 126 ms
39,388 KB
testcase_28 AC 127 ms
39,684 KB
testcase_29 AC 138 ms
40,072 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import static java.lang.Math.*;
import java.math.BigDecimal;

public class Main {
	
	
  public static void main(String[] args) {
	  Scanner sc=new Scanner(System.in);
	  int n=sc.nextInt();
	  BigDecimal ans=new BigDecimal("0");
	  
	  for(int i=0;i<n;i++){
		  BigDecimal x=sc.nextBigDecimal();
		  ans=ans.add(x);
	  }
	  String S=String.valueOf(ans);
	  char s[]=S.toCharArray();
	  boolean ten=false;
	  int syousuu=0;
	  for(int i=0;i<s.length;i++){
		  if(ten)syousuu++;
		  if(s[i]=='.')ten=true;
	  }
	  System.out.print(ans);
	  if(!ten)System.out.print(".");
	  for(int i=0;i<10-syousuu;i++){
		  System.out.print(0);
	  }
	  System.out.println();
  }}
0