본문 바로가기
2022 하반기/Python

백준 python

by concho 2023. 1. 26.

백준 2525

""" 
2525
"""

import sys

nTime, nMin = map(int, sys.stdin.readline().split());
cookMin = int(sys.stdin.readline());
tm = (60 * nTime + cookMin + nMin); 


if(tm > 1439) :
    tm %= 1440


print(tm // 60, end = " ");
print(tm % 60);

백준 1110

import sys

N = int(sys.stdin.readline());
tmN = N;
first = 0; last = 0; cnt = 0;

while 1:
    first = N // 10
    last = N % 10
    N = (first + last) % 10 + last * 10
    cnt += 1
    if(N == tmN): 
        print(cnt)
        break

백준 1546

python code

import sys

n = int(sys.stdin.readline());
fm = list( map(float, sys.stdin.readline().split() ) );

print((sum(fm) / max(fm) * 100) / n);

c code

#include <stdio.h>


int main(void) {
	int n = 0;
	double m = 0, tm = 0, sum = 0;
	scanf("%d", &n);

	for (int i = 0; i < n; i++) {
		scanf("%lf", &m);
		if (m > tm) tm = m;
		sum += m;
	}
	sum = (sum / tm * 100) / n;
	printf("%lf", sum);
}

백준 1065

import sys

n = int(sys.stdin.readline());
tm = 0; cnt = 99;
if n < 100 :
    print(n);
else :
    for i in range(100 , n + 1):
        n1 = i // 100;
        n2 = ( i % 100 ) // 10;
        n3 = i % 10;

        tm = abs(n1 - n2);
        if n2 == n1 + tm and n3 == n2 + tm :
            cnt += 1
        elif n2 == n3 + tm and n1 == n2 + tm :
            cnt += 1
    print(cnt)

 

 

'2022 하반기 > Python' 카테고리의 다른 글

백준 1436 Python  (0) 2023.02.07
백준 1018 python  (0) 2023.02.02
백준 7568 python  (2) 2023.02.02
백준 2231 python  (0) 2023.01.29
백준 2798 python  (0) 2023.01.26

댓글