[ AtCoder ] Boot camp for Beginners - ( ABC 048 ) B - Between a and b ...
·
-- 예전 기록/AtCoder
https://atcoder.jp/contests/abc048/tasks/abc048_b B - Between a and b ... AtCoder is a programming contest site for anyone from beginners to experts. We hold weekly programming contests online. atcoder.jp a 와 b 사이에 있는 정수 중 x로 나누어 떨어지는 수를 찾기 위해, b를 x로 나눈 몫에서 a를 x로 나눈 몫을 뺀다. ( a가 x로 나누어 떨어지면 이를 포함해야 하므로, a가 x로 나누어 떨어지면 결과값에 1을 더한다. ) import sys input = sys.stdin.readline a, b, x = map(int, input()..
[ AtCoder ] Boot camp for Beginners - ( AGC 029 ) A - Irreversible operation
·
-- 예전 기록/AtCoder
https://atcoder.jp/contests/agc029/tasks/agc029_a A - Irreversible operation AtCoder is a programming contest site for anyone from beginners to experts. We hold weekly programming contests online. atcoder.jp s[i] 번째 문자가 W면, W를 왼쪽으로 가져가기 위해 i 번 만큼 flip 해야 한다. 이전에 W가 k번 나왔다면, i - k 번 만큼 flip 해야 한다. import sys input = sys.stdin.readline s = input().rstrip() result = 0 cnt = 0 for i in range(len(s))..
[ AtCoder ] Boot camp for Beginners - ( ABC 156 ) C - Rally
·
-- 예전 기록/AtCoder
https://atcoder.jp/contests/abc156/tasks/abc156_c C - Rally AtCoder is a programming contest site for anyone from beginners to experts. We hold weekly programming contests online. atcoder.jp 1부터 100까지 해당 좌표에서 미팅을 열었을 때의 포인트를 전부 계산하여 최소 포인트를 찾는다. import sys input = sys.stdin.readline n = int(input().rstrip()) arr = list(map(int, input().rstrip().split())) result = -1 for i in range(1, 101): now =..
[ AtCoder ] Boot camp for Beginners - ( ABC 065 ) B - Trained?
·
-- 예전 기록/AtCoder
https://atcoder.jp/contests/abc065/tasks/abc065_b B - Trained? AtCoder is a programming contest site for anyone from beginners to experts. We hold weekly programming contests online. atcoder.jp 1번 버튼부터 시작해서, 1번 버튼에서 이어지는 버튼인 a[1]번 버튼으로, a[1]번 버튼에서 이어지는 버튼인 a[a[1]]번 버튼으로, a[a[1]] 번 버튼에서 이어지는 버튼인 a[a[a[1]]] 버튼으로.... 계속해서 찾아가면서 2번 버튼에 도달하면 버튼을 거쳐간 횟수를 출력한다. 방문 배열을 추가해서, 만약 이전에 이어졌던 버튼에 다시 도달했다면 2번 ..
[ AtCoder ] Boot camp for Beginners - ( ABC 139 ) B - Power Socket
·
-- 예전 기록/AtCoder
https://atcoder.jp/contests/abc139/tasks/abc139_b B - Power Socket AtCoder is a programming contest site for anyone from beginners to experts. We hold weekly programming contests online. atcoder.jp AtCoder Problems 의 Boot camp for Beginners 탭을 활용하여 연습하기로 하였다. 처음엔 문제를 제대로 읽지 않고 구현했다가, 멀티탭이 소켓 하나를 이용한다는 특징을 생각하지 못하고 WA를 받았다. A와 B의 제한이 작아 단순 반복문 구현으로 해결해도 되는 문제이다. import sys input = sys.stdin.readl..