結果
問題 |
No.81 すべて足すだけの簡単なお仕事です。
|
ユーザー |
![]() |
提出日時 | 2016-11-16 01:07:16 |
言語 | Java (openjdk 23) |
結果 |
RE
|
実行時間 | - |
コード長 | 944 bytes |
コンパイル時間 | 2,209 ms |
コンパイル使用メモリ | 76,152 KB |
実行使用メモリ | 42,864 KB |
最終ジャッジ日時 | 2024-11-26 02:00:26 |
合計ジャッジ時間 | 7,630 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 1 WA * 10 RE * 19 |
ソースコード
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); long sum1 = 0; long sum2 = 0; for(int i=0; i<N; i++){ String S = sc.next(); int t = S.indexOf("\\."); if(t!=-1){ sum1+=add(S); }else{ sum1+=add(S); sum2+=add2(S); } } long m=10000000000L; sum1+=sum2/m; sum2%=m; System.out.println(sum1+"."+sum2); } static long add(String S){ String [] arr = S.split("\\."); long a = Long.parseLong(arr[0]); return a; } static long add2(String S){ String [] arr = S.split("\\."); while(arr[1].length()<10 ){ arr[1] = arr[1]+"0"; } long a = Long.parseLong(arr[1]); return a; } }