본문 바로가기

Programming/데일리 알고리즘

190725_덩치(7568)_C

//
// Created by yejin kim on 2019-07-25.
//
#include <stdio.h>
#include <stdlib.h>

int main(void) {
    int count;
    scanf("%d", &count);

    int *x = (int*)malloc(sizeof(int)*count);
    int *y = (int*)malloc(sizeof(int)*count);
    for ( int i=0; i<count; i++) {
        scanf("%d", &x[i]); //몸무게
        scanf("%d", &y[i]); //키
    }

    int __comp_x = 0;
    int __comp_y = 0;
    for ( int i=0; i<count; i++ ) {
        int __x = x[i];
        int __y = y[i];
        int check = 0;
        for ( int j=0; j<count; j++ ) {
            if ( __x < x[j] && __y < y[j] ) {
                check++; //나는 몇개보다 작은가?
            }
        }

        printf("%d ", check+1);
    }
}

'Programming > 데일리 알고리즘' 카테고리의 다른 글

(210409:BTB) Lesson 2. CyclicRotation  (0) 2021.04.10
(210409:BTB) Lesson 1. BinaryGap  (0) 2021.04.09
190719_소수구하기_C  (0) 2019.07.19
190713_ACM호텔_C  (0) 2019.07.13
190712_카잉 달력_C  (0) 2019.07.12