| 1 |
#include <iostream> |
| 2 |
#include <string> |
| 3 |
#include <strstream> |
| 4 |
#include <vector> |
| 5 |
|
| 6 |
int main() |
| 7 |
{ |
| 8 |
vector<int> sizes; |
| 9 |
char buf[64000]; |
| 10 |
while(cin.getline(buf, 64000)) |
| 11 |
{ |
| 12 |
int size = 0; |
| 13 |
for(int i = 0;buf[i] != '\0';++i) |
| 14 |
{ |
| 15 |
if (buf[i] == ' ') |
| 16 |
size++; |
| 17 |
} |
| 18 |
sizes.push_back(size); |
| 19 |
} |
| 20 |
|
| 21 |
double average = 0; |
| 22 |
int max = sizes[0]; |
| 23 |
int min = sizes[0]; |
| 24 |
int over100 = 0; |
| 25 |
int over200 = 0; |
| 26 |
int over500 = 0; |
| 27 |
|
| 28 |
for(int i = 0;i < sizes.size();++i) |
| 29 |
{ |
| 30 |
if (sizes[i] > max) |
| 31 |
max = sizes[i]; |
| 32 |
|
| 33 |
if (sizes[i] < min) |
| 34 |
min = sizes[i]; |
| 35 |
|
| 36 |
average += double(sizes[i]) / sizes.size(); |
| 37 |
|
| 38 |
if (sizes[i] > 100) |
| 39 |
over100++; |
| 40 |
|
| 41 |
if (sizes[i] > 200) |
| 42 |
over200++; |
| 43 |
|
| 44 |
if (sizes[i] > 500) |
| 45 |
{ |
| 46 |
over500++; |
| 47 |
cout << "over 500: " << i << endl; |
| 48 |
} |
| 49 |
} |
| 50 |
|
| 51 |
cout << "min: " << min << endl; |
| 52 |
cout << "max: " << max << endl; |
| 53 |
cout << "avg: " << average << endl; |
| 54 |
cout << "over100: " << over100 << endl; |
| 55 |
cout << "over200: " << over200 << endl; |
| 56 |
cout << "over500: " << over500 << endl; |
| 57 |
return 0; |
| 58 |
} |