본문 바로가기

programming/algorithm 공부

[Algorithm] Handshake / 악수 > Quest.At the annual meeting of Board of Directors of Acme Inc, every one starts shaking hands with everyone else in the room. Given the fact that any two persons shake hand exactly once, Can you tell the total count of handshakes? > Input.Input Format The first line contains the number of test cases T, T lines follow. Each line then contains an integer N, the total number of Board of Directors.. 더보기
[Algorithm] Divisible Sum Pairs > Quest.You are given an array of integers, , and a positive integer, . Find and print the number of pairs where and + is evenly divisible by . > Input.Input Format The first line contains space-separated integers, and , respectively. The second line contains space-separated integers describing the respective values of . > Output.Output Format Print the number of pairs where and + is evenly divi.. 더보기
[Algorithm] 캥거루 두 마리 > Quest.There are two kangaroos on an x-axis ready to jump in the positive direction (i.e, toward positive infinity). The first kangaroo starts at location and moves at a rate of meters per jump. The second kangaroo starts at location and moves at a rate of meters per jump. Given the starting locations and movement rates for each kangaroo, can you determine if they'll ever land at the same locat.. 더보기
[Algorithm] 사과나무와 오렌지나무 > Quest.Sam's house has an apple tree and an orange tree that yield an abundance of fruit. In the diagram below, the red region denotes his house, where is the start point and is the end point. The apple tree is to the left of his house, and the orange tree is to its right. You can assume the trees are located on a single point, where the apple tree is at point and the orange tree is at point . .. 더보기
[Algorithm] Angry Professor > Quest.A Discrete Mathematics professor has a class of students. Frustrated with their lack of discipline, he decides to cancel class if fewer than students are present when class starts. Given the arrival time of each student, determine if the class is canceled. > Input.Input Format The first line of input contains , the number of test cases. Each test case consists of two lines. The first lin.. 더보기

반응형