분류 전체보기 (284) 썸네일형 리스트형 코틀린 1일차 fun main(args: Array) println("hello, world") } fun max(a:Int, b:Int): Int { return if (a>b) a else b } println(max(1,2)) == fun max(a:Int, b:Int) = if(a>b) a else b enum class Color(var r: Int, var g:Int, var b:Int) { BLUE(0, 0, 255); fun rgb()=(r*256+g)*256 + b } println(Color.BLUE.rgb()) fun getMNemonic(color:Color) = wehn(color) { Color.BLUE, Color.Red -> "Batlle" } println(getMNemonic(Color.. 18115)카드 스택 #include #include #include #define MAX 1000000 int moto[MAX]; struct node { int card; struct node * next; struct node * prev; }; int main(void) { int num; scanf_s("%d", &num); int imsi; for (int i = 0; i card = 1; head->next = NULL; head->prev = NULL; struct node * tail = head; for (int i = 2; i card = i; switch (moto[num-i]) { case 1: head->next = noder; noder->next = NULL; noder->prev = head; .. 1260)dfs bfs #include #include #define TRUE 1 #define FALSE 0 #define MAX 1001 int arr[MAX][MAX] = { 0, }; int visit[MAX] = { FALSE, }; int queue[MAX]; //int isEmpty() //{ // if (front == back) // return TRUE; // else // return FALSE; //} //void addque(int value) //{ // back = (back + 1) % MAX; // queue[back] = value; //} //int delque() //{ // front = (front + 1) % MAX; // return queue[front]; //} //int seek.. 2328)임시)런타임에러뜸)그래프의 해시 #include #include #define TRUE 1 #define FALSE 0 #define MAX 901 #define INF 5001 int stack[MAX]; int top = -1; int hash[MAX]; int hashtop = 0; void push(int value) { stack[++top] = value; } int pop() { return stack[top--]; } int stacksize() { if (top 18110) 문제 난이도 매기기 #include #include #include # define SWAP(x, y, temp) ( (temp)=(x), (x)=(y), (y)=(temp) ) int partition(int *arr, int left, int right, int number) { int pivot, temp; int low, high; low = left; high = right+1; pivot = arr[left]; do { do { low++; } while (low = left && arr[high] > pivot); if (low < high) { SWAP(arr[low], arr[high], temp); } } while (low < high); SWAP(arr[left], arr[high], temp); re.. ㅅㄱ그라운드) python #플로이드 워셔 알고리즘 def FloydWarshall(cost): n = len(cost) for i in range(n): cost[i][i] = 0 #자기 자신의 거리는 0 for k in range(n): for i in range(n): #n*n 동안, j는 n의 범위 내에서, cost[i][j]는 cost[i][j]와, cost[i][k]+cost[k][j] 중 하나로 결정 됨. 더 작은 값으로. 배열의 거리 총 재정렬 for j in range(n): cost[i][j] = min(cost[i][j], cost[i][k]+cost[k][j]) #메인함수 시작 n, m, r = map(int,input().split()) cost = [[float('inf')]*n for i in range.. 14938) ㅅㄱ그라운드 #include #include #define INF 1000; int choose(int *path, int n, int *found) { int i, min, minpos; min = INF; minpos = -1; for (i = 0; i 친구비)python import sys input= sys.stdin.readline def find(target): if network[target]==target: return target network[target]=find(network[target]) return network[target] def union(a,b): findA= find(a) findB= find(b) if findA==findB: return if findA 이전 1 ··· 31 32 33 34 35 36 다음 목록 더보기