Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[이태경] 1차원 배열(3문제) #64

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 55 additions & 1 deletion .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions baekjoon/1546/이태경.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# 백준_1차원 배열_평균
# https://www.acmicpc.net/problem/1546

import sys
input = sys.stdin.readline # 하운님 팁

n = int(input()) # 시험 본 과목의 총 개수
m = list(map(int, input().split())) # 세준이의 현재 성적들을 리스트에 담음
maxScore = max(m) # 리스트에 담긴 성적 중에서 최고 점수

newList = [] # 빈 리스트 생성
for score in m:
newList.append(score / maxScore * 100) # 새로운 점수 생성 후에 빈 리스트에 담기

newAvg = sum(newList)/n # 리스트에 담긴 점수들을 n으로 나누기
print(newAvg)
19 changes: 19 additions & 0 deletions baekjoon/4344/이태경.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# 백준_1차원 배열_평균은 넘겠지
# https://www.acmicpc.net/problem/4344

import sys
input = sys.stdin.readline

c = int(input()) # 테스트 케이스 개수

for _ in range(c): # c만큼 반복
n = list(map(int, input().split())) # 학생 수 및 점수들을 리스트에 담기
avg = sum(n[1:]) / n[0] # index[0] == 학생 수, index[1:] == 점수들
cnt = 0
for score in n[1:]: # 점수 각각을 score에 선언
if score > avg: # 점수가 평균보다 높다면
cnt += 1 # 평균 이상인 학생 수 카운트
rate = cnt / n[0] * 100 # 평균 이상 학생 수 / 학생수 * 100 == 평균 이상인 학생의 비율

print(f'{rate:.3f}%') # f-string 문법으로 rate 변수를 받고
# ':'구분자를 써서 '.3f' 소수점(float) 3자리 까지 출력
20 changes: 20 additions & 0 deletions baekjoon/8958/이태경.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# 백준_1차원 배열_OX퀴즈
# https://www.acmicpc.net/problem/8958

import sys
input = sys.stdin.readline

n = int(input()) # test case 개수

for _ in range(n): # n 만큼 반복
ox_list = list(input()) # 입력 받은 OX를 리스트에 저장
score = 0 # 점수 초기화
sum_score = 0 # 총 점수 초기화

for ox in ox_list: # ox_list 만큼 반복하고 각각을 ox에 저장
if ox == 'O': # ox가 'O'이라면
score += 1 # 'O'가 나올 때 마다 1점씩 추가
sum_score += score # score를 최종 점수에 합산
else:
score = 0 # 'O'가 아니라면 0점 처리
print(sum_score)