解法一
✅ 完整代碼
- 時間 O(1)
- 空間 O(1)
#include <bits/stdc++.h>
using namespace std;
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
int t;
cin >> t;
int a, b, c, d;
for(int i=0; i<t; i++){
cin >> a >> b >> c >> d;
cout << a << " " << b << " " << c << " " << d << " ";
if(b/a == d/c) cout << d * (d/c) << "\n";
else cout << d + (d-c) << "\n";
}
return 0;
}