일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- 소수찾기
- popleft
- 소수판별
- deque
- 브루투포스
- 합 구하기
- appendleft
- python3
- 파이썬
- c#
- BFS
- 그리디 알고리즘
- Python
- 연관관계
- 1일1솔
- spring
- 백준
- LCM
- C#강의
- mvc
- 완전탐색
- 프로그래머스
- unity
- DP
- JPA
- 누적합
- Java
- 인프런
- pypy3
- 우선순위큐
- Today
- Total
목록분류 전체보기 (139)
jae_coding

문제 문제 링크 코드 case 1 (rotate) import sys from collections import deque input = sys.stdin.readline n = int(input()) balloons = deque(enumerate(map(int, input().split()))) result = list() while balloons: x, value = balloons.popleft() result.append(x+1) if value > 0: balloons.rotate(-(value - 1)) else: balloons.rotate(-value) print(*result) case 2 (append, pop 활용) import sys from collections import d..

문제 문제 링크 코드 import sys from collections import deque input = sys.stdin.readline input_string = deque(input().strip()) count = 0 result = 0 primary_string = "" while len(input_string) != 0: temp = input_string.pop() if temp == ")": count += 1 else: if primary_string == "(": count -= 1 result += 1 else: count -= 1 result += count primary_string = temp print(result)

문제 문제 링크 코드 import sys from collections import deque input = sys.stdin.readline # 1 + 2 * 3 - 4 / 5 = 7 - 0.8 = 6.2 n = int(input()) input_string = list(input().strip()) list_num = [0] * n for i in range(n): list_num[i] = int(input()) stack = deque() for i in input_string: if 'A'

문제 문제 링크 코드 import sys from collections import deque input = sys.stdin.readline n = int(input()) stack = deque(i for i in range(1, n+1)) stack2 = deque() primary_num = 0 flag = False result = list() for _ in range(n): input_number = int(input()) temp = 0 if primary_num < input_number: flag = False else: flag = True while True: if temp != input_number and flag is False: if len(stack) != 0: temp =..
상속 상위 클레스에 있는 변수나 함수를 사용하기 위함 상위 클레스 using System.Collections; using System.Collections.Generic; using UnityEngine; public class Human : MonoBehaviour { // protected는 상속받은 클레스에서만 사용가능하다. protected string humanName; protected int humanage; // virtual 하위 클레스에서 함수를 재정의할 수 있도록 만든다. protected virtual void Info(){ print("나는 인간입니다."); } //추가적인 변수를 넣어주기 위함 (완성은 자식클레스에서 완성시킬 수 있다. 이때는 하위 클레스에서 abstract를 ..
델리게이트 여러개의 함수를 한번에 사용하기 위함 이전 코드 using System.Collections; using System.Collections.Generic; using UnityEngine; public class Unity_lecture : MonoBehaviour { int power; int defence; public void SetPower(int value){ power += value; print("power의 값이" + value + "만큼 증가하였습니다. 총 power의 값이 " + power + "입니다."); } public void SetDefence(int value){ defence += value; print("defence의 값이" + value + "만큼 증가하였습..
Sturct 구조는 클레스와 동일하지만, 직접 값을 대입시킬 수 없다. 단순히 구조체 역할만 한다. 값을 대입시키기 위해서는 Public을 넣어주거나 parameter를 받아 값을 넣어줄 수 있다. 상속이 불가능하다. class의 구버전이라고 생각하면 될 것 같다. using System.Collections; using System.Collections.Generic; using UnityEngine; public struct School{ public int student_number; public int a; public int b; public int c; public int d; public void Get_number(int Value){ student_number = Value; } // 생..
Namespace: 누군가 만들어 놓은 클레스와 변수, 그리고 함수를 가져다 사용하는 것. 네임스페이스를 사용하는 이유는 대형 프로젝트나 협업을 하는데 함수의 명이나 변수의 이름이 곂칠 경우를 대비하기 위함이다. using을 통하여 어떤 네임스페이스의 어떠한 변수나 함수, 그리고 네임스페이스를 언급해주고 다른 네임스페이스와 곂치지 않게 할 수 있다. using System.Collections; using System.Collections.Generic; using UnityEngine; using Namespace.School; namespace Namespace { namespace School{ public class Person { int student; public void SetFlag(int..
컬렉션 배열의 크기에 대한 단점을 보완해주는 집합체 ArrayList: 연산량이 많아 과부하가 걸릴 수 있다. using System.Collections; using System.Collections.Generic; using UnityEngine; public class Unity_lecture : MonoBehaviour { //배열의 크기가 5로 고정 int[] exp = new int[5] {1, 2, 3, 4, 5}; //컬렉션: 리스트, 큐, 스택, 해시테이블, 딕셔너리, 어레이리스트 //컬렉션을 사용하기 위해서는 using System.Collections;를 head에 넣어주어야함 ArrayList arrayList = new ArrayList(); void Start(){ // Add:..
변수들의 집합체: 배열 using System.Collections; using System.Collections.Generic; using UnityEngine; public class Unity_lecture : MonoBehaviour { // 배열의 선언 int [] exp = {50, 100, 150, 200, 250, 300}; void Start(){ // case 1 print(exp[1]); // 여서 1은 index (배열의 Index는 0부터 시작하므로 100이 출력) print(exp[2]); // 150출력 print(exp[3]); // 200출력 print(exp[4]); // 250출력 print(exp[5]); // 300출력 print(exp[6]); // index의 범..