#include <vector>
#include <map>
#include <iostream>
int main(int argc, char ** argv)
{
const std::vector<int> scores = {76, 89, 150, 135, 200, 76, 12, 100, 150, 28, 178, 189,
167, 200, 175, 150, 87, 99, 129, 149, 176, 200, 87,
35, 157, 189
};
std::map<int, int> scoreCount;
std::cout << "Number of Scores: " << scores.size() << "\n";
for(auto score : scores)
{
scoreCount[score/25] ++;
std::cout << score << " - scoreCount Index: " << score/25 << "\n";
}
for(auto const& slot : scoreCount)
{
auto low = slot.first*25;
auto high = low+24;
std::cout << "Range " << low << "-" << high << ": " << slot.second << "\n";
}
int sum = 0;
for(auto const& slot : scoreCount)
sum += slot.second;
if(sum < 26)
printf("\n%d: Wrong number of scores counted.\n", sum);
else
printf("\nAll students accounted for.\n");
}
I2luY2x1ZGUgPHZlY3Rvcj4KI2luY2x1ZGUgPG1hcD4KI2luY2x1ZGUgPGlvc3RyZWFtPgoKaW50IG1haW4oaW50IGFyZ2MsIGNoYXIgKiogYXJndikKewogICAgY29uc3Qgc3RkOjp2ZWN0b3I8aW50PiBzY29yZXMgPSB7NzYsIDg5LCAxNTAsIDEzNSwgMjAwLCA3NiwgMTIsIDEwMCwgMTUwLCAyOCwgMTc4LCAxODksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAxNjcsIDIwMCwgMTc1LCAxNTAsIDg3LCA5OSwgMTI5LCAxNDksIDE3NiwgMjAwLCA4NywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDM1LCAxNTcsIDE4OQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgc3RkOjptYXA8aW50LCBpbnQ+IHNjb3JlQ291bnQ7CiAgICBzdGQ6OmNvdXQgPDwgIk51bWJlciBvZiBTY29yZXM6ICIgPDwgc2NvcmVzLnNpemUoKSA8PCAiXG4iOwoKICAgIGZvcihhdXRvIHNjb3JlIDogc2NvcmVzKQogICAgewogICAgICAgIHNjb3JlQ291bnRbc2NvcmUvMjVdICsrOwog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