1 solutions
-
0
#include<bits/stdc++.h> using namespace std; int main() { int i,j,x,y; //循环男人可能的人数 for(i = 0; i <= 50 / 3; i++){ //剩余的钱 x = 50 - i * 3; //循环女人可能的人数 for(j = 0; j <= x / 2; j++){ y = x - j * 2; //剩余的y元,分配给小孩,要求总人数为30 if(i+j+y == 30){ cout << i << " " << j << " " << y << endl; } } } return 0; }
- 1
Information
- ID
- 590
- Time
- 1000ms
- Memory
- 16MiB
- Difficulty
- 10
- Tags
- # Submissions
- 2
- Accepted
- 2
- Uploaded By