#include<string>
#include<sstream>
using namespace std;
void replaceD(string &str)
{
int i = 0;
while(i < str.length())
{
if (str[i] == ',')
str[i] = ' ';
i++;
}
}
int main()
{
int N;
string str;
cin >> N;
getline(cin,str);
for (int i = 0;i < N; i++)
{
int k,a1,a2,sum,b1,b2,b3,b4,c;
getline(cin,str);
replaceD(str);
stringstream ss(str);
ss >> k >> a1 >> a2;
b1 = 0;
b2 = 0;
b3 = 0;
b4 = 0;
c = 1;
if (a1 == 1)
{
sum = k - (a2 * 17);
}
else if (a1 == 2)
{
sum = k - (a2 * 25);
}
b1 = sum / 50;
b2 = (sum % 50) / 10;
b3 = ((sum % 50) % 10) / 5;
b4 = ((sum % 50) % 10) % 5;
for (int j = 0;j < 4; j++)
{
if (j == 0 && b4 != 0)
{
cout << "Coin 1:" << b4;
c++;
}
else if (j == 1 && b3 != 0)
{
if (c - 1 > 0)
cout << ",";
cout << "Coin 5:" << b3;
c++;
}
else if (j == 2 && b2 != 0)
{
if (c - 1 > 0)
cout << ",";
cout << "Coin 10:" << b2;
c++;
}
else if (j == 3 && b1 != 0)
{
if (c - 1 > 0)
cout << ",";
cout << "Coin 50:" << b1;
c++;
}
}
cout << endl;
}
return 0;
}
沒有留言:
張貼留言