回答編集履歴
2
floatの方が早そうなのでfloatに戻す
answer
CHANGED
@@ -18,6 +18,7 @@
|
|
18
18
|
if line == "":
|
19
19
|
break
|
20
20
|
index, value = line.split('\t')
|
21
|
+
index = round(float(index), 4)
|
21
22
|
total[index] += float(value)
|
22
23
|
count[index] += 1
|
23
24
|
|
1
インデックスを文字列のまま処理
answer
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
これだとどれくらいの時間になりますかね?
|
2
2
|
|
3
|
-
|
4
3
|
```python
|
5
4
|
import os
|
6
5
|
from collections import defaultdict
|
@@ -18,9 +17,8 @@
|
|
18
17
|
for line in lines:
|
19
18
|
if line == "":
|
20
19
|
break
|
21
|
-
index, value =
|
20
|
+
index, value = line.split('\t')
|
22
|
-
index = round(index, 4)
|
23
|
-
total[index] += value
|
21
|
+
total[index] += float(value)
|
24
22
|
count[index] += 1
|
25
23
|
|
26
24
|
for index in sorted(total):
|