IT 개발자_S

해커랭크 Breaking the Records 본문

IT/알고리즘_Python

해커랭크 Breaking the Records

Soso12 2020. 3. 22. 20:43
반응형

#!/bin/python3

 

import math

import os

import random

import re

import sys

 

# Complete the breakingRecords function below.

def breakingRecords(scores):

    hs = 0

    ls =0

    hs_count =0

    ls_count =0

 

    length = len(scores) -1

 

    ls = scores[0]

    hs = scores[0]

    print(ls, hs)

 

    for i in range(len(scores)) :

        if( hs < scores[i]) :

            hs = scores[i]

            hs_count +=1

        if(ls > scores[i]) :

            ls =scores[i]

            ls_count +=1

 

    return  hs_count, ls_count

 

if __name__ == '__main__':

    fptr = open(os.environ['OUTPUT_PATH'], 'w')

 

    n = int(input())

 

    scores = list(map(intinput().rstrip().split()))

 

    result = breakingRecords(scores)

 

    fptr.write(' '.join(map(str, result)))

    fptr.write('\n')

 

    fptr.close()

 

반응형

'IT > 알고리즘_Python' 카테고리의 다른 글

해커랭크 Picking Numbers  (0) 2020.03.29
해커랭크 Brithday Chocolate  (0) 2020.03.22
해커랭크 Kangaroo PYTHON  (0) 2020.03.13
해커랭크 Apple and Orange  (0) 2020.03.12
해커랭크 Grading Strudents  (0) 2020.03.12
Comments