AtCoder Beginners Contest 077 [A-C]

AtCoder ABC077 Note

A. Rotation … If second input is same as the reverse of the first input, it is true.

B. Around Square … Get the square root of the input, print out the square number based on the floor of the obtained number.

C. Snuke Festival … First I used product module to list out all the combination, but it takes O(n^3) and caused TimeOut.

Solution is – Sort the top parts list and bottom parts list. For each mid parts, count the number of top parts which is smaller than the mid parts, and count the number of the bottom parts which is bigger than the mid parts. I used bisect module to get the respective index.

AtCoder Beginners Contest 078 [A to C]

AtCoder 初心者向けコンテスト078のメモ

A. HEX … Just a simple comparison of two characters.

B. ISU … Subtract the edge width from the seat length, and just need to divide the remaining length divided by the width of the person and the required gap.

C. HSI … Calculate the duration of a trial. Respective trial has the chance of 1/2^m to get all test cases passed. So it’s just a one-liner to get the correct answer.