1 solutions

  • 0
    @ 2023-1-17 14:30:46
    #include<bits/stdc++.h>
    using namespace std;
    int main()
    {
    	int i,j,k,l;//分别代表4个人的年龄
    	//遍历第一个人年龄可能的范围
    	for(i = 1; i <= 23; i++){
    		//遍历第二个人年龄可能的范围
    		for(j = i+1; j <= 26-i-2; j++){
    			k = j + j - i;//第三个人年龄
    			l = k + j - i;//第四个人年龄
    			//总年龄26,且乘积880则输出
    			if(i+j+k+l == 26 && i*j*k*l == 880){
    				cout << i << " " << j << " " << k << " " << l << endl;
    			} 
    		} 
    	} 
    	return 0;
    }
    
    
    • 1

    Information

    ID
    591
    Time
    1000ms
    Memory
    16MiB
    Difficulty
    10
    Tags
    # Submissions
    3
    Accepted
    3
    Uploaded By