码迷,mamicode.com
首页 > 编程语言 > 详细

C语言 · 方程的解

时间:2017-04-01 20:31:23      阅读:172      评论:0      收藏:0      [点我收藏+]

标签:==   bsp   相加   正整数   stdio.h   include   ++   语言   return   

给出方程组:

  11x + 13y + 17z = 2471

  13x + 17y + 11z = 2739

??已知 x,y,z均为正整数,请你计算 x,y,z 相加和最小为多少。

作者注释:哎呀,不多说,填空题暴力出结果就行。

 1 #include<stdio.h>
 2 int main(){
 3     int x,y,z;
 4     int min=3000;
 5     for(int x=1;x<1000;x++){
 6         for(int y=1;y<1000;y++){
 7             for(int z=1;z<1000;z++){
 8                 if((11*x+13*y+17*z==2471) && (13*x+17*y+11*z==2739)){
 9                     if((x+y+z)<min){
10                         min=x+y+z;
11                         printf("%d\n",min);
12                     }
13                 }
14             }
15             
16         }
17     }
18     return 0;
19 }

 

C语言 · 方程的解

标签:==   bsp   相加   正整数   stdio.h   include   ++   语言   return   

原文地址:http://www.cnblogs.com/panweiwei/p/6657364.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!