백준(4)
-
백준 14891번 톱니바퀴 파이썬 시간(32ms) 1등 코드 공유
아무래도 연산을 최소화시켰더니 결과가 이렇게 된 것 같다!!재귀를 활용하되, 톱니바퀴가 동시에 돌아간다는 것을 이용해서 바깥쪽부터 바꿔주는 식으로 코드를 구성했음..# 14891. 톱니바퀴import sysinput = sys.stdin.readlinedef rotate(total: list, north: list, index: int, direction: int, arrow: int): # 왼쪽으로 전파 if arrow = 1: now_thing_west = total[index][(north[index]-2)%8] left_thing_east = total[index-1][(north[index-1]+2)%8] if now_thin..
2024.09.21 -
[acmicpc] 백준 7568 덩치 C언어 정답 코드
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 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 #include #include typedef struct _Person { public: unsigned int nWeight; unsigned int nHeight; unsigned int nRank; bool operator
2020.04.12 -
[acmicpc] 백준 2446번: 별 찍기 - 9 (피라미드 출력하기)
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 31 32 33 34 35 36 #include #define MAX(a,b) ((a > b) ? a : b) void fnPrintPyramid(int start, int end) { int nOperator = 1, nGreaterSize = MAX(start, end); if(start - end > 0) nOperator = -1; for(int i = start; (i - end) * nOperator
2020.04.09 -
[어셈블리어] 백준 2557번 Hello World 런타임 오류 해결법
백준 2557번을 어셈블리어로 풀다가 런타임 오류가 떠서 들어오신 분들은 어셈블리어에 대해 어느정도는 숙지하고 계실 거라 생각해요. 2557번에 대한 설명을 원하시는 분들은 뒤로가기를 누르셔도 됩니다.. (죄송합니다 ㅠㅠ) 제 생각에 자신의 컴퓨터에서는 돌아가는데 백준 온라인 채점에서 막히는 사람이 있을거라 생각해요. 만약 아래와 같은 컴파일 오류가 뜬다면, /usr/lib/../lib32/crt1.o: In function `_start': (.text+0x18): undefined reference to `main' collect2: error: ld returned 1 exit status 메인 함수의 이름을 main으로 하지 않았을 확률이 높아요. 한번 section .text 부분을 global..
2020.01.29