문제 : https://www.acmicpc.net/problem/8912
[알고리즘풀이]
Input 크기가 작아서 단순 구현하면 되는 문제다.
#include<iostream>
using namespace std;
int list[1000];
int main(void) {
ios::sync_with_stdio(false);
cin.tie(0), cout.tie(0);
int test_case;
cin >> test_case;
for (int i = 0; i < test_case; i++) {
int ninput;
cin >> ninput;
int total = 0;
for (int j = 0; j < ninput; j++){
cin >> list[j];
for (int k = 0; k < j; k++) {
if (list[k] <= list[j])
total++;
}
}
cout << total << '\n';
}
}
'Problem Solving > ICPC' 카테고리의 다른 글
[ICPC][BOJ] 13333 - 'Q-Index' (0) | 2019.09.23 |
---|---|
[ICPC][BOJ] 13335 - Trucks (0) | 2019.09.23 |
[ICPC][BOJ] 9093 - Word Reversal (0) | 2019.09.23 |
[ACM-ICPC][BOJ] 8896 - Rock Paper Scissors (0) | 2019.09.04 |
[ACM-ICPC][BOJ] 10251 - Driving License (0) | 2019.08.27 |