www.acmicpc.net/problem/14889 14889번: 스타트와 링크 예제 2의 경우에 (1, 3, 6), (2, 4, 5)로 팀을 나누면 되고, 예제 3의 경우에는 (1, 2, 4, 5), (3, 6, 7, 8)로 팀을 나누면 된다. www.acmicpc.net from itertools import combinations N=int(input()) l=[x for x in range(N)] S=[] result=int(1e9) for i in range(N): S.append(list(map(int, input().split()))) comb=list(combinations(l,N//2)) length=len(comb)//2 for i in range(length): start=0 lin..
www.acmicpc.net/problem/9205 9205번: 맥주 마시면서 걸어가기 송도에 사는 상근이와 친구들은 송도에서 열리는 펜타포트 락 페스티벌에 가려고 한다. 올해는 맥주를 마시면서 걸어가기로 했다. 출발은 상근이네 집에서 하고, 맥주 한 박스를 들고 출발한다. www.acmicpc.net from collections import deque t=int(input()) INF=int(1e9) for _ in range(t): flag=0 n=int(input()) graph=[[INF]*(n+3) for _ in range(n+3)] array=[[] for _ in range(n+3)] visited=[False]*(n+3) l=[()] for a in range(1,n+3): for b ..
www.acmicpc.net/problem/2467 2467번: 용액 첫째 줄에는 전체 용액의 수 N이 입력된다. N은 2 이상 100,000 이하의 정수이다. 둘째 줄에는 용액의 특성값을 나타내는 N개의 정수가 빈칸을 사이에 두고 오름차순으로 입력되며, 이 수들은 모두 - www.acmicpc.net n=int(input()) liquids=list(map(int, input().split())) left=0 right=2000000000 while left
www.acmicpc.net/problem/2644 2644번: 촌수계산 사람들은 1, 2, 3, …, n (1≤n≤100)의 연속된 번호로 각각 표시된다. 입력 파일의 첫째 줄에는 전체 사람의 수 n이 주어지고, 둘째 줄에는 촌수를 계산해야 하는 서로 다른 두 사람의 번호가 주어진 www.acmicpc.net n=int(input()) a,b=map(int, input().split()) graph=[[] for _ in range(n+1)] visited=[False]*(n+1) m=int(input()) result=-1 for _ in range(m): i,j=map(int, input().split()) graph[i].append(j) graph[j].append(i) def dfs(a, b,..
www.acmicpc.net/problem/1987 1987번: 알파벳 세로 R칸, 가로 C칸으로 된 표 모양의 보드가 있다. 보드의 각 칸에는 대문자 알파벳이 하나씩 적혀 있고, 좌측 상단 칸 (1행 1열) 에는 말이 놓여 있다. 말은 상하좌우로 인접한 네 칸 중의 한 칸으 www.acmicpc.net r, c=map(int, input().split()) graph=[] dx=[-1,1,0,0] dy=[0,0,-1,1] visited=[[False]*c for _ in range(r)] alphabet=[False]*26 result=0 for _ in range(r): graph.append(input()) def dfs(x, y, count): global result visited[x][y]=T..
#include int main(void){double loan, rate, payment, result,monthly_rate;printf("Enter amount of loan: ");scanf("%lf",&loan);printf("Enter interest rate: ");scanf("%lf",&rate);printf("Enter monthly payment: ");scanf("%lf",&payment);monthly_rate=rate/12;result=(double)loan*(1+(monthly_rate/100))-payment;printf("Balance remaining after first payment: %.2lf\n",result);result=(double)result*(1+(month..
#include int main(void){int dollar;printf("Enter a dollar amount: ");scanf("%d",&dollar);printf("$20 bills: %d",(int)dollar/20);printf("\n$10 bills: %d",(int)(dollar%20)/10);printf("\n$5 bills: %d",(int)(dollar%10)/5);printf("\n$1 bills: %d\n",(int)(dollar%5)/1);return 0; } 위의 것보단 아래 것이 좋은듯.가독성 좋고 이해하기 쉽다.앞에 \n 안붙여도 자동 줄바꿈 된다. #include int main(void){int dollar;printf("Enter a dollar amount: ");..