/images/jg_02.jpg

SW Expert Academy_D3 10505, 10200, 3376, 5642

D3_10505_소득 불균형

1
2
3
4
5
6
7
8
9
for T in range(int(input())):
    N = int(input())
    dp = [0] * 100001
    Max = 0
    for i in list(map(int, input().split())):
        dp[i] += 1
        Max += i

    print(f'#{T+1} {sum(dp[:int(Max/N)+1])}')

D3_10200_구독자 전쟁

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
for T in range(int(input())):
    N, A, B = map(int, input().split())
    # 최소값 구하기
    if A+B >= N:
        Min = (A+B)-N
        if A >= B:
            Max = B
        else:
            Max = A
    else:
        Min = 0
        if A >= B:
            Max = B
        else:
            Max = A

    print(f'#{T+1} {Max} {Min}')

Block_Chain setting & basic

🎈가상환경에서 블록체인 채굴 및 기본 시스템 정리

1. geth(Go-ethereum) 설치

블록체인 기술은 중앙집중화된 데이터베이스에 반기를 들고 나온 개념이기 때문에 중앙 서버 이런게 없다. 즉 누구라도 해당 블록체인 네트워크에 참여하고 싶다면 언제라도 블록체인 데이터베이스를 싱크해주는 로컬 프로그램을 다운 받아 실행하면 데이터를 받을 수 있다.

BEAKJOON 1149, 1932, 2579, 1463

1149_RGB거리

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
N = int(input())
RGB = [list(map(int, input().split())) for _ in range(N)]

for i in range(1, len(RGB)):
    RGB[i][0] = RGB[i][0] + min(RGB[i-1][1], RGB[i-1][2])
    RGB[i][1] = RGB[i][1] + min(RGB[i-1][0], RGB[i-1][2])
    RGB[i][2] = RGB[i][2] + min(RGB[i-1][0], RGB[i-1][1])
print(min(RGB[i][0], RGB[i][1], RGB[i][2]))

# 2시간이 넘게 고민한 결과...
# 문제 속 조건3 ""i(2 ≤ i ≤ N-1)번 집의 색은 i-1번, i+1번 집의 색과 같지 않아야 한다.""을 이해하는데 시간이 걸렸다.
# 조건3에 따르면 N=3인 경우, i = 2가 되고, 결국 1번, 3번 집의 색과 2번 집의 색이 다르면 된다.
# 난 이걸.. 1번집과 3번집의 색이 달라야 한다고 잘못 이해해서 시간을 버렸다.ㅎ

BEAKJOON 1103, 1904, 2748, 9461

1003_피보나치 함수

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
def Fibonacci(N):
    if N < 3:
        print(zero[N], one[N])
    else:
        f = 1
        s = 2
        for i in range(N-2):
            zero.append(zero[f] + zero[s])
            one.append(one[f] + one[s])
            f += 1
            s += 1
        print(zero[N], one[N])

for T in range(int(input())):
    N = int(input())

    zero = [1, 0, 1]
    one = [0, 1, 1]

    Fibonacci(N)

1904_01타일

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
def Fibonacci(N):
    result: 0
    f = 0
    s = 1
    for i in range(1, N+3):
        if i == 1:
            result = f
        elif i == 2:
            result = s
        else:
            result = f+s
            f = s % 15746
            s = result % 15746
    print(result % 15746)

Fibonacci(int(input()))

# 문제를 먼저 손으로 플어보니 결국 피보나치 수열이 답이었는데
# 15746의 나머지가 답이어서 그런지 '시간 초과'가 발생했다.
# 때문에 '왜맞틀?'로 고민하다 검색해보니 결과값을 15746의 나머지로 더한다는
# 방법을 보고 이를 참고했다. (솔직이 아직 이게 왜 더 빠른지 잘 모르겠다.)