#include <iostream> #include <algorithm> using namespace std; int main() { int n[9]; int sum = 0; for (int i = 0; i < 9; i++) { cin >> n[i]; sum += n[i]; } sort(n, n+9); for (int i = 0; i < 8; i++) for (int j = i + 1; j < 9; j++) if ((n[i] + n[j]) == (sum - 100)) for (int x = 0; x < 9; x++) if (x != i && x != j) cout << n[x] << endl; }
이렇게 제출하면 맞고 밑에있는 소스코드로 제출하면 틀렸다고 나오는데 왜 그런지 알려주세요..ㅠㅠㅠ 제가보기엔 똑같은거같은데
bass358 6년 전
#include <iostream>
이렇게 제출하면 맞고 밑에있는 소스코드로 제출하면 틀렸다고 나오는데 왜 그런지 알려주세요..ㅠㅠㅠ 제가보기엔 똑같은거같은데#include <algorithm>
using namespace std;
int main()
{
int n[9];
int sum = 0;
for (int i = 0; i < 9; i++)
{
cin >> n[i];
sum += n[i];
}
sort(n, n+9);
for (int i = 0; i < 8; i++)
for (int j = i + 1; j < 9; j++)
if ((n[i] + n[j]) == (sum - 100))
for (int x = 0; x < 9; x++)
if (x != i && x != j)
cout << n[x] << endl;
}