九度:1036<枚举>

来源:互联网 发布:怎样使用ps软件 编辑:程序博客网 时间:2024/04/27 23:22



// 九度:1036//////#include <stdio.h>int main(){#ifdef ONLINE_JUDGE#elsefreopen("E:\\in.txt", "r", stdin);//freopen("E:\\out.txt", "w", stdout);#endifint n;while(scanf("%d", &n) != EOF){int x , y, z;scanf("%d%d%d", &x, &y, &z);int t = x*1000 + y*100 + z*10;int max=0, t1, t2;for(int i=1; i<=9; i++){for(int j=0; j<=9; j++){int totalprice = i*10000 + t + j;if(totalprice%n == 0){int per = totalprice/n;if(per > max){max=per;t1 = i;t2 = j;}}}}if(max != 0){printf("%d %d %d\n", t1, t2, max);}else{printf("0\n");}}//whilereturn 0;}


0 0
原创粉丝点击