35.鸡兔同笼问题:今有雉兔同笼,上有三十五头,下有九十四足,问雉兔各几何?
#include<iostream> using namespace std; int main() { int Ji,Tu; int k=0; for(int i=1;i<=35;i++) { Ji=i; for(int j=1;j<=35;j++) { Tu=j; if((Ji+Tu==35)&&(2*Ji+4*Tu==94)) { cout<<"Ji= "<<Ji<<" Tu= "<<Tu<<endl; k++; } } } cout<<"The total number is "<<k<<endl; return 0; }