#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <queue> #include <vector> using namespace std; int main(void) { int n; scanf("%d", &n); getchar(); while (n--) { char str[20] = {0}; int num = 0; scanf("%s", str); if (strlen(str) > 2) { num = (str[strlen(str) - 2] - '0') * 10 + str[strlen(str) - 1] - '0'; str[strlen(str) - 2] = 0; } else { if (strlen(str) == 2) num = (str[0] - '0') * 10 + str[1] - '0'; else if (strlen(str) == 1) num = str[0] - '0'; str[0] = '0'; str[1] = 0; } printf("%s ", str); printf("%d ", num / 50); num %= 50; printf("%d ", num / 20); num %= 20; printf("%d ", num / 10); num %= 10; printf("%d ", num / 5); num %= 5; printf("%d\n", num); } } |
Double click to view unformatted code.