일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | |
7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 | 29 | 30 |
- 파이썬
- 소수판별
- BFS
- JPA
- 합 구하기
- Java
- DP
- 소수찾기
- 우선순위큐
- 누적합
- python3
- 그리디 알고리즘
- 1일1솔
- appendleft
- pypy3
- 완전탐색
- c#
- unity
- 연관관계
- spring
- popleft
- LCM
- deque
- 프로그래머스
- C#강의
- mvc
- 브루투포스
- Python
- 인프런
- 백준
- Today
- Total
목록분류 전체보기 (139)
jae_coding
전역변수, 지역변수, 매개변수 int a = 5; //멤버 변수, 전역변수 void Abc(){ a = 6; int b = 5; // 지역변수 print(b); } void Abc2(){ a = 6; int b = 5; // 지역변수 print(b); } void Abc3(float _parameter){ print(_parameter); // 매개변수 } 전역변수: 전체 코드에 적용할 수 있는 변수 지역변수: 예를들어 하나의 함수안에 선언되어있는 변수(함수 내에서만 사용되는 변수, 전역변수와 이름이 같으면 지역변수가 우선순위가 더 높다) 매개변수: 함수를 사용하기 위해서 매개체로 이용되는 변수 Private, Public의 개념 Private: 다른 class에서 사용이 불가능 Public: 다른 cl..
함수의 기능 예제 함수 using System.Collections; using System.Collections.Generic; using UnityEngine; public class Unity_lecture : MonoBehaviour { int intValue; float floatValue = 10.1f; void FloatToInt(){ intValue = (int)floatValue; } void Start() { FloatToInt(); print(intValue); } // Update is called once per frame void Update() { } } 예제의 코드에서는 함수가 1번밖에 사용되어지지 않았지만, 함수가 여러변 그리고 함수의 내용이 길게 된다면 반복되는 작업을 간..
자료형의 종류 정수 자료형 byte: 정수자료형 0 ~ 256 (1byte) sbyte: 정수자료형 -128 ~ 127 (1byte) short: 정수자료형 -30,000 ~ 30,000 (2byte) integer: 정수자료형 -20억 ~ 20억 (4byte) long: 정수 자형 (8byte) 실수자료형 신뢰성: float < double < decimal 자료형의 선언 // 실수형 float f = 1.000001f; double d = 4.000001; decimal m = 3.000001m; // 문자열 string s = "ABCDEFG"; char c = 'A'; // 0065 유니코드로 변환된다. 자료형의 연산 //자료형이 다른 경우 int a = 100; long b = 100; long..
Unity C # Script의 기본 구성 using System.Collections; using System.Collections.Generic; using UnityEngine; public class Unity_lecture : MonoBehaviour { // 최초 1회 실행 void Start() { } // 매 Frame마다 업데이트 void Update() { } } 변수 예를들어 x의 값에 정수 100을 넣고싶다면 타입 변수명 = 정수 + 세미콜론(;)으로 선언을 해주면된다. 흔히 C언어와 변수를 선언하는 것이 동일하다. using System.Collections; using System.Collections.Generic; using UnityEngine; // public class..

문제 문제 링크 코드 # popleft 위쪽에 덱 제거 # appendleft 위쪽에 덱 추가 # pop 아래쪽 덱 제거 # append 아래쪽 덱 추가 import sys from collections import deque input = sys.stdin.readline def push_front(lst, num): lst.appendleft(num) def push_back(lst, num): lst.append(num) def pop_front(lst): if len(lst) != 0: print(lst.popleft()) else: print(-1) def pop_back(lst): if len(lst) != 0: print(lst.pop()) else: print(-1) def size(lst..

문제 문제 링크 코드 import sys from collections import deque input = sys.stdin.readline N, K = map(int, input().split()) lst = deque(i for i in range(1, N+1)) result = list() count = 0 while len(lst) != 0: count += 1 if count % K != 0: lst.append(lst.popleft()) else: result.append(lst.popleft()) ans = "")

문제 문제 링 코드 import sys from collections import deque input = sys.stdin.readline def push(lst, num): lst.append(num) def pop(lst): if len(lst) != 0: print(lst[0]) lst.popleft() else: print(-1) def size(lst): print(len(lst)) def empty(lst): if len(lst) != 0: print(0) else: print(1) def front(lst): if len(lst) != 0: print(lst[0]) else: print(-1) def back(lst): if len(lst) != 0: print(lst[-1]) else: ..

문제 문제 링크 코드 import sys input = sys.stdin.readline T = int(input()) def VPS(inp_str): result = 0 for i in inp_str: if i == '(': result += 1 elif i == ')': result -= 1 if result < 0: break return result for _ in range(T): inp_str = list(input().strip()) ans = VPS(inp_str) if ans == 0: print("YES") else: print("NO")

문제 문제 링크 코드 import sys input = sys.stdin.readline N = int(input()) stack = list() def push(stack, num): stack.append(num) def pop(stack): if len(stack) != 0: n = stack[len(stack)-1] print(n) del stack[-1] else: print(-1) def size(stack): print(len(stack)) def empty(stack): if len(stack) == 0: print(1) else: print(0) def top(stack): if len(stack) != 0: print(stack[len(stack)-1]) else: print(-1) f..

문제 문제 링크 문제 접근 N의 범위가 20만으로 매우크기 때문에 for문을 2번이상 돌리는 것은 효율적이지 않다고 생각했다. 자료구조인 dictionary를 이용하는 것이 효율적이라고 생각한다. 코드 import sys input = sys.stdin.readline N, K = map(int, input().split()) lst = list(map(int, sys.stdin.readline().split())) memo = {0: 1} sum_value = 0 result = 0 for val in lst: sum_value += val # 이전 누적값에서 - K인 것이 존재한다면 result에 추가해줌 if sum_value - K in memo.keys(): result += memo[sum_v..