반응형
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | #include <iostream> using namespace std; int compare(const void*a, const void*b) { return *(int*)a - *(int*)b; } int main() { int N; cin >> N; int *a = new int[N]; for (int i = 0; i < N; i++) { cin >> a[i]; } qsort(a, N, sizeof(int), compare); cout << a[0] * a[N - 1]; } | cs |
'Algorithm' 카테고리의 다른 글
C++(씨쁠쁠)(cplusplus)-백준(baekjoon)(BaekJoon)코딩 5598번:카이사르 암호 답 (0) | 2016.12.10 |
---|---|
C++(씨쁠쁠)(cplusplus)-백준(baekjoon)(BaekJoon)코딩 1476번:날짜 계산 답 (0) | 2016.12.09 |
C++(씨쁠쁠)(cplusplus)-백준(baekjoon)(BaekJoon)코딩 11728번:배열 합치기 답 (0) | 2016.12.07 |
C++(씨쁠쁠)(cplusplus)-백준(baekjoon)(BaekJoon)코딩 5622번:다이얼 답 (0) | 2016.12.06 |
C++(씨쁠쁠)(cplusplus)-백준(baekjoon)(BaekJoon)코딩 2193번:이친수 답 (0) | 2016.12.05 |