結果

問題 No.81 すべて足すだけの簡単なお仕事です。
ユーザー cympfhcympfh
提出日時 2016-03-16 10:54:43
言語 Ruby
(3.3.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 322 bytes
コンパイル時間 194 ms
コンパイル使用メモリ 11,304 KB
実行使用メモリ 15,376 KB
最終ジャッジ日時 2023-08-21 13:22:37
合計ジャッジ時間 3,793 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 78 ms
15,148 KB
testcase_01 AC 79 ms
15,068 KB
testcase_02 AC 79 ms
15,144 KB
testcase_03 AC 78 ms
15,168 KB
testcase_04 AC 79 ms
15,276 KB
testcase_05 AC 77 ms
15,236 KB
testcase_06 AC 77 ms
15,148 KB
testcase_07 AC 77 ms
15,144 KB
testcase_08 AC 76 ms
15,188 KB
testcase_09 AC 77 ms
15,172 KB
testcase_10 WA -
testcase_11 AC 77 ms
15,140 KB
testcase_12 AC 77 ms
15,248 KB
testcase_13 AC 77 ms
15,148 KB
testcase_14 AC 76 ms
15,180 KB
testcase_15 AC 78 ms
15,060 KB
testcase_16 AC 77 ms
15,340 KB
testcase_17 WA -
testcase_18 AC 76 ms
15,192 KB
testcase_19 AC 78 ms
15,244 KB
testcase_20 AC 79 ms
15,312 KB
testcase_21 AC 77 ms
15,080 KB
testcase_22 AC 76 ms
15,172 KB
testcase_23 AC 77 ms
15,144 KB
testcase_24 AC 77 ms
15,080 KB
testcase_25 AC 75 ms
15,324 KB
testcase_26 AC 76 ms
15,308 KB
testcase_27 WA -
testcase_28 AC 76 ms
15,112 KB
testcase_29 AC 76 ms
15,144 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

gets
x=y=0
readlines.map{|s|
  a=s.chomp.split('.')
  x += a[0].to_i
  y += (s[0]=='-' ? -1 : 1) * ((a[1]==nil ? '' : a[1]) + "0000000000000000000")[0..9].to_i
}
M=10000000000
while y < 0
  y += M
  x -= 1
end
x += y/M
y %= M

if x >= 0 or y == 0
  puts sprintf("%d.%010d",x,y)
else
  puts sprintf("%d.%010d",x+1,M-y)
end
0