fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int a,b,c;
  6. for(a=0;a<33;a++)
  7. for(b=0;b<50;b++)
  8. {
  9. c=(100-a*3-b*2)*2;
  10. if(c!=100 && (a+b+c)==100)
  11. cout<<"大马"<<a<<"匹, "<<"中马"<<b<<"匹, "<<"小马"<<c<<"匹"<<endl;
  12. }
  13. return 0;
  14. }
Success #stdin #stdout 0s 15240KB
stdin
Standard input is empty
stdout
大马2匹, 中马30匹, 小马68匹
大马5匹, 中马25匹, 小马70匹
大马8匹, 中马20匹, 小马72匹
大马11匹, 中马15匹, 小马74匹
大马14匹, 中马10匹, 小马76匹
大马17匹, 中马5匹, 小马78匹
大马20匹, 中马0匹, 小马80匹