Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
35
Task/Text-processing-1/Aime/text-processing-1.aime
Normal file
35
Task/Text-processing-1/Aime/text-processing-1.aime
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
integer bads, count, max_bads;
|
||||
file f;
|
||||
list l;
|
||||
real s;
|
||||
text bad_day, worst_day;
|
||||
|
||||
f.stdin;
|
||||
|
||||
max_bads = count = bads = s = 0;
|
||||
|
||||
while (f.list(l, 0) ^ -1) {
|
||||
integer i;
|
||||
|
||||
i = 2;
|
||||
while (i < 49) {
|
||||
if (0 < atoi(l[i])) {
|
||||
count += 1;
|
||||
s += atof(l[i - 1]);
|
||||
if (max_bads < bads) {
|
||||
max_bads = bads;
|
||||
worst_day = bad_day;
|
||||
}
|
||||
bads = 0;
|
||||
} else {
|
||||
if (!bads) {
|
||||
bad_day = l[0];
|
||||
}
|
||||
bads += 1;
|
||||
}
|
||||
i += 2;
|
||||
}
|
||||
}
|
||||
|
||||
o_form("Averaged /d3/ over ~ readings.\n", s / count, count);
|
||||
o_("Longest bad run ", max_bads, ", started ", worst_day, ".\n");
|
||||
Loading…
Add table
Add a link
Reference in a new issue