[ SWEA ] D2 - 1970, 1966, 1961, 1959 - python 문제풀이
1970 쉬운 거스름돈 지불할 수 있는 돈의 종류(option)들을 순회하면서, 최대한 낼 수 있는 개수만큼 쓰고 다음 단위(더 작은 지불 단위 옵션)으로 넘어가게 해서 풀 수 있음 options = [50000,10000,5000,1000,500,100,50,10] for tc in range(int(input())): N = int(input()) cnt = [0]*8 for i in range(8): if N != 0: cnt[i] += N//options[i] N %= options[i] else: break print("#{}\n{}".format(tc+1, " ".join(map(str,cnt)))) 1966 숫자를 정렬하자 방법 1 - sort 함수 사용 방법 2 - 개수를 세어나갈 카운트 ..
2021. 6. 26.
[ SQL 고득점 kit ] String, Date - mysql
01 루시와 엘라 찾기 SELECT ANIMAL_ID, NAME, SEX_UPON_INTAKE FROM ANIMAL_INS WHERE NAME in ('Lucy', 'Ella', 'Pickle', 'Rogan', 'Sabrina', 'Mitty'); 02 이름에 el이 들어가는 동물 찾기 mysql의 대소문자 구분여부 컬럼, 테이블명 : 대소문자 구분O VARCHAR,TEXT같은 데이터 : 대소문자 구분X 따라서 이 문제의 경우 대소문자 지정을 따로 해주지 않아도 풀리기는 한다(아래처럼) SELECT ANIMAL_ID, NAME FROM ANIMAL_INS WHERE ANIMAL_TYPE = 'Dog' AND NAME LIKE '%el%' ORDER BY NAME; 만약 mysql을 쓰지 않을때는 low..
2021. 6. 26.
[ SWEA ] D2 - 1983, 1979, 1976, 1974 - python 문제풀이
1983 조교의 성적매기기 scores = ["A+","A0","A-","B+","B0","B-","C+","C0","C-","D"] for tc in range(int(input())): N,K = map(int, input().split()) # i번째 점수는 (i+1)번 학생의 점수 info = [list(map(int, input().split())) for _ in range(N)] student_scores = [] for i in range(N): total = info[i][0]*0.35 + info[i][1]*0.45 + info[i][2]*0.2 student_scores.append([total, (i+1)]) student_scores.sort(key=lambda x:x[0],rev..
2021. 6. 24.