blob: c57d9ff215fd99d577a395ed46cce9e23d4261d5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
#include <iostream>
#include <stdio.h>
using namespace std;
/* post-process the output of tabulate.sh */
/* input:
[x1] [y1_0]
[x1] [y1_1]
...
[x2] [y2_0]
[x2] [y2_1]
...
[x] is an integer up to 100
*/
/* output:
[x1] [average y1]/2^[x1] [stddev y1]
*/
static double sums[100] = { 0 }, means[100] = { 0 }, deltasq[100] = { 0 };
static int counts[100] = { 0 };
int main()
{
while(cin)
{
int x;
double y;
cin >> x >> y;
long long div = 1 << x;
sums[x] += y / div;
counts[x]++;
}
for(int i = 0; i < 100; ++i)
{
if(counts[i])
{
means[i] = sums[i] / counts[i];
printf("%d %g\n", i, means[i]);
}
}
}
|