[鸭子题] 算法设计编程赛ADPC2021-3-14
奇怪的小鸭子也增加了
Description
这题是个签到题。
有一个 A×B 的大澡盆,还有若干个 a×b 的长方形小鸭子,澡盆里最少放几只鸭子后,便无法再向其中放入更多的鸭子?
鸭子很倔强,不能旋转成 b×a ,也不能重叠放置。
Input
四个整数,分别表示 A,B,a,bA,B,a,b
1<=a<=A<=30000
1<=b<=B<=30000
Output
最少能放几只鸭子。
Sample Input 1
12 10 4 5
Sample Output 1
2
Sample Input 2
20 10 9 2
Sample Output 2
3
Hint

1 #include <iostream> 2 using namespace std; 3 4 int main(){ 5 6 int a ,b ,x ,y; 7 cin >> a >> b >> x >> y; 8 int i; 9 for(i = 0 ; i<= a/x; i++) 10 { 11 if((a-x *i)/(i+1) < x) break; 12 } 13 int j ; 14 for(j = 0; j <=b/y;j++) 15 { 16 if((b-y*j)/ (j+1) <y) break; 17 } 18 19 prinntf("%d", i * j ); 20 21 return 0; 22 }
思路:


浙公网安备 33010602011771号