#include <iostream>
using namespace std;
int main(){
double grn[] = {1.24, 0.56, .32, 1, 4.2};
size_t nom[] = {25, 10, 5, 1};//мають буди відсоротовані по зменшенню
size_t grn_size = sizeof(grn) / sizeof(grn[0]);
size_t nom_size = sizeof(nom) / sizeof(nom[0]);
for( size_t i = 0; i < grn_size; i++ )
{
size_t dif = grn[i]*100;
size_t cnt = 0;
cout<<grn[i]<<" : "<<endl;
for( size_t j = 0; dif && (j < nom_size); j++)
{
cnt = dif / nom[j];
cout<<nom[j]<<" = "<<cnt<<endl;
dif -= cnt*nom[j];
}
}
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwogCmludCBtYWluKCl7CiAgICBkb3VibGUgIGdybltdID0gezEuMjQsIDAuNTYsIC4zMiwgMSwgNC4yfTsKICAgIHNpemVfdCBub21bXSA9IHsyNSwgMTAsIDUsIDF9Oy8v0LzQsNGO0YLRjCDQsdGD0LTQuCDQstGW0LTRgdC+0YDQvtGC0L7QstCw0L3RliDQv9C+INC30LzQtdC90YjQtdC90L3RjgogICAgc2l6ZV90IGdybl9zaXplID0gc2l6ZW9mKGdybikgLyBzaXplb2YoZ3JuWzBdKTsKICAgIHNpemVfdCBub21fc2l6ZSA9IHNpemVvZihub20pIC8gc2l6ZW9mKG5vbVswXSk7CiAgICBmb3IoIHNpemVfdCBpID0gMDsgaSA8IGdybl9zaXplOyBpKysgKQogICAgewogICAgCXNpemVfdCBkaWYgPSBncm5baV0qMTAwOwogICAgCXNpemVfdCBjbnQgPSAwOwogICAgCWNvdXQ8PGdybltpXTw8IiA6ICI8PGVuZGw7CiAgICAJZm9yKCBzaXplX3QgaiA9IDA7IGRpZiAmJiAoaiA8IG5vbV9zaXplKTsgaisrKQogICAgCXsKICAgIAkJY250ID0gZGlmIC8gbm9tW2pdOwogICAgCQljb3V0PDxub21bal08PCIgPSAiPDxjbnQ8PGVuZGw7CiAgICAJCWRpZiAtPSBjbnQqbm9tW2pdOyAKICAgIAl9CiAgICB9CiAgICByZXR1cm4gMDsKfQ==