5086
5086번 : 배수와 약수
#include <iostream>
using namespace std;
int main() {
while (true) {
int a, b;
cin >> a >> b;
if (a == 0 && b == 0)
break;
if (b % a == 0)
cout << "factor" << endl;
else if (a % b == 0)
cout << "multiple" << endl;
else
cout << "neither" << endl;
}
return 0;
}
1037
1037번 : 약수
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
int num;
cin >> num;
int arr[1000000];
for (int i = 0; i < num; i++)
cin >> arr[i];
sort(arr, arr + num);
cout << arr[num - 1] * arr[0];
}