Wrong Answer
Code
#include <bits/stdc++.h>
using namespace std;
int gcm(int a, int b, int c, int X) {
int gcm = -1;
for (int i = 1; i < X; i++) {
if (i % a == 0 && i % b == 0 && i % c == 0) {
gcm = i;
break;
}
}
return gcm;
}
int main() {
int t;
cin >> t;
while (t--) {
int a, b, c, X;
cin >> a >> b >> c >> X;
int ans = gcm(a, b, c, X);
cout << ans << endl;
}
return 0;
}
Information
- Submit By
- Type
- Submission
- Problem
- P1025 GCM
- Contest
- Brain booster #2
- Language
- C++20 (G++ 13.2.0)
- Submit At
- 2024-03-06 13:42:25
- Judged At
- 2024-11-11 03:42:14
- Judged By
- Score
- 2
- Total Time
- 2ms
- Peak Memory
- 764.0 KiB