【C++】OJ147

#include<iostream>
using namespace std;
int main(){
	double a;
	cin >> a;
	int x = 0;
	double number[10] = {0.00};
	number[x] = a;
	int time[10] = {0};
	int q = 0;
	while(a!=0.00){
        int b = a*100;
		for(int i = 0;i<=b/10000;i++){
			for(int j = 0;j<=b/5000;j++){
				for(int k = 0;k<=b/2000;k++){
					for(int s = 0;s<=b/1000;s++){
						for(int y = 0;y<=b/500;y++){
							for(int u = 0;u<=b/100;u++){
								for(int o = 0;o<=b/50;o++){
									for(int r = 0;r<=b/20;r++){
										for(int t = 0;t<=b/10;t++){
											for(int e = 0;e<=b/5;e++){
												if(5*e+10*t+20*r+50*o+100*u+500*y+1000*s+2000*k+5000*j+10000*i==b){
													time[q]++;
												}
											}
										}
									}
								}
							}
					}
				}
			}
		}
	}
		q++;
		cin >> a;
		x++;
		number[x] = a;
}
	for(int d = 0;d<q;d++){
		cout << number[d]<<"\t"<<time[d]<<endl;
	}
}

点赞