백준 브론즈 1 모음
https://www.acmicpc.net/problem/1546
n = int(input())
score = list(map(int,input().split()))
max = max(score)
sum = 0
for i in score:
sum += i/max*100
print(sum/n)
*l은 뭘까... 주소?
n,*l=map(int,open(0).read().split())
print(sum(l)*100/max(l)/n)
https://www.acmicpc.net/problem/1924
import datetime as dt
a,b = map(int,input().split())
days = ['MON ', 'TUE', 'WED', 'THU', 'FRI', 'SAT', 'SUN']
date = dt.datetime(2007,a,b)
print(days[date.weekday()])
얜 진짜 뭐지? 이건 원리를 이해 못 함
l=[0,31,28,31,30,31,30,31,31,30,31,30,31]
i=['SUN', 'MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT']
a, b = map(int,input().split())
c=sum(l[:a])
c=(b+c)%7
print(i[c])
https://www.acmicpc.net/problem/2675
n = int(input())
for _ in range(n):
a,b = input().split()
for j in b:
print(j*int(a),end='')
print()
print()와 print('\n')의 차이는 뭘까. 이미 프린트함수에 줄바꿈이 포함이 돼 있는데 거기서 \n으로 한 번 더 해주는 건가
https://www.acmicpc.net/problem/1157
s = input().upper()
list_s = list(set(s))
res = []
for i in list_s:
res.append(s.count(i))
if res.count(max(res)) >1:
print('?')
else:
print(list_s[(res.index(max(res)))])
이거 내가 안 풀었다. 너무 어려움 다음에 다시 풀기!
https://www.acmicpc.net/problem/11050
라이브러리 있을 것 같았는데 귀찮아서 그냥 짬. 근데 검색하는 게 더 나았을 듯 ㅎ
a,b = map(int,input().split())
s1 = s2 = 1
for i in range(1,a+1):
s1 *= i
for j in range(1,b+1):
s2 *= j
for k in range(1,a-b+1):
s2 *= k
print(int(s1/s2))
import math
print(math.comb(*map(int,input().split())))
https://www.acmicpc.net/problem/1110
do/while을 쓰고 싶다면 while True:로 하고 반복 마지막에 조건을 달아주면 되는구나! 근데 문자열로 푸니까 시간초과가 나네 ㅇ0ㅇ
n = input()
s = n
count = 0
while True:
if len(n) == 1:
k = int(n)
else:
k = int(n[0]) + int(n[-1])
k = str(k)
n = n[-1] + k[-1]
count += 1
if n == s:
break
print(count)
이건 숫자로 푸는 방법! 아직 내가 //랑 % 쓰는 것에 익숙하지 않은 듯 ㅎ히
n = int(input())
r = n
count = 0
while True:
a = r//10
b = r%10
c = (a+b)%10
r = (b*10)+c
count += 1
if n == r:
print(count)
break
https://www.acmicpc.net/problem/2309
와 나 진짜 입출력 하나도 모르겠다. 11/4에 꼭 정리한다!!
l = [int(input()) for _ in range(9)]
l.sort()
s = sum(l)
bpoint = False
for i in l:
for j in l:
if i!=j:
k = s-i-j
if k == 100:
l.remove(i)
l.remove(j)
bpoint = True
break
if bpoint:
break
for i in l:
print(i)
에휴 멋쟁이들이 정말 많군 :(
a=[]
for i in range(9):
a.append(int(input()))
for i in a:
b=sum(a)-i-100
if b in a and i!=b:
a.remove(i)
a.remove(b)
a.sort()
for i in a:
print(i)
여기서부터 깃허브 업로드 안 함
https://www.acmicpc.net/problem/1037
a = input()
l = map(int,input().split())
l = sorted(l)
print(l[0]*l[-1])
정렬 안 하고 min(l), max(l)로 쓸 수 있음.
https://www.acmicpc.net/problem/2163
어려워보였는데 알고리즘 분류 보니까 바로 풀림
아직 처음이라 그렇겠지? 문제만 보고 어떤 알고리즘으로 풀어야할지 보이는 그날까지 ㅍㅇㅌ!
w,h = map(int,input().split())
print(w*h-1)
https://www.acmicpc.net/problem/11170
n = int(input())
for _ in range(n):
a,b = map(int,input().split())
sum = 0
for i in range(a,b+1):
sum += str(i).count('0')
print(sum)
https://www.acmicpc.net/problem/1834
원래는 int((n**3-n)/2)로 했는데 뭐 int 범위 밖인지 초과가 났다. 그래서 구글링해서 일단 맟추고 숏코딩 봄. 다음부터 2로 나눈 결과가 딱 떨어지면 //를 써서 몫만 구해야지
n = int(input())
print((n**3-n)//2)
n = int(input())
r = 0
for i in range(1,n):
r += n*i+i
print(r)