알고리즘 문제/BOJ
7568번 덩치
parkit
2018. 12. 29. 03:16
728x90
반응형
https://www.acmicpc.net/problem/7568
문제에 나와있는데로만 구현하면 된다.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | #include <iostream> #include <queue> #include <stack> #include <cstdio> #include <vector> #include <cstring> #include <string> #include <math.h> #include <algorithm> #include <map> using namespace std; typedef struct wh { int weight; int height; }wh; vector<wh> v; vector<int> Rank; wh p; int main(void) { int N = 0, w = 0, h = 0; scanf("%d", &N); for (int i = 0; i < N; i++) { scanf("%d %d", &w, &h); p.weight = w; p.height = h; v.push_back(p); } for (int i = 0; i < v.size(); i++) { int r = 1; for (int j = 0; j < v.size(); j++) { if (v.at(j).weight > v.at(i).weight && v.at(j).height > v.at(i).height) { ++r; } } Rank.push_back(r); } for (auto r : Rank) printf("%d ", r); printf("\n"); return 0; } | cs |
728x90
반응형