#include <stdio.h> #include <stdlib.h> int main() { int iNum =0; int cofficients[6] = {0}; while (EOF != scanf("%d", &iNum) && 0 != iNum ) { int iCount =0; for (cofficients[0] =0; cofficients[0] <= iNum; ++cofficients[0]) { for (cofficients[1] =0; cofficients[1] <= iNum/2; ++cofficients[1] ) { for (cofficients[2] =0; cofficients[2] <= iNum/5; ++cofficients[2] ) { for (cofficients[3] =0; cofficients[3] <= iNum/10; ++cofficients[3] ) { for (cofficients[4] =0; cofficients[4] <= iNum/50; ++cofficients[4] ) { for (cofficients[5] =0; cofficients[5] <= iNum/100; ++cofficients[5] ) { if (iNum == cofficients[0] + 2*cofficients[1] + 5*cofficients[2] + 10 * cofficients[3] + 50*cofficients[4] +100 * cofficients[5]) { iCount++; } } } } } } } printf("%d\n", iCount); } return 0; }
时间: 2024-10-10 20:50:12