AtCoder (2) 썸네일형 리스트형 166F Three Variables Game https://atcoder.jp/contests/abc166/tasks/abc166_f F - Three Variables Game AtCoder is a programming contest site for anyone from beginners to experts. We hold weekly programming contests online. atcoder.jp 세개의 숫자 A, B, C와 N개의 이벤트(AB, AC, BC중에 하나)들이 주어진다. 각 주어진 이벤트의 두개 알파벳중에 하나에 1을 더해주면 다른 하나는 1을 빼주면 된다. N번의 이벤트들을 실행하는중에 A, B, C 중에 하나가 음수가 된다면 실패이고, N번 모두 성공하면 각각의 이벤트마다 1더해준 알파벳들을 출력하면 되는 문제이다. 조.. 166E This Message Will Self-Destruct in 5s https://atcoder.jp/contests/abc166/tasks/abc166_e E - This Message Will Self-Destruct in 5s AtCoder is a programming contest site for anyone from beginners to experts. We hold weekly programming contests online. atcoder.jp 두개의 인덱스의 차이와 각 인덱스에 해당하는 키의 합이 같은 짝의 갯수를 찾는 문제이다. 다시 말해서 j - i = h[j] + h[i] for i < j 인 짝이 몇개인지 찾아야 한다. 이 식을 바꿔보면 i + h[i] = j - h[j]가 된다. 1부터 n까지 h를 입력받을때마다 배열 a에 i + h[i]값을.. 이전 1 다음