SoC는 이제 카메라테스트까지 남은 시간동안 손 떼도 될것같고 이번주는 ACM에 올인 예정.
ACM을 너무 소홀히 한건가;;
오랜만에 문제를 풀려니 풀리지가 않네;;
그나저나 SoC 준비하느라 고생한 우리 팀원들 모두 수고하셨습니다.
한게 없어서 민망하긴 하지만;;
그래도 끝냈네요...

아래 사진은 밤샘과 노가다의 산물.

사용자 삽입 이미지

사용자 삽입 이미지
  1. Favicon of BlogIcon Raven the Revenger 2007.07.16 12:02 신고

    고생 많았어. =ㅅ=)/
    이제 ACM 문제 풀면서 기다릴 일만 남았네 =ㅅ=

    • Favicon of BlogIcon RyuiSaka 2007.07.17 02:57 신고

      고생은 내가 제일 안했지 뭐;;
      알고리즘 구현하느라 니가 고생 많았지;
      이제 테스트때까지 좀 느긋하게 나가도 되는건가;;

Sample Test Case

문제 :

A게 답게 쉬웠던 문제.
예외처리는 안했음.


Source Code

Sample Input

영어문제는 항상 해석하는게 귀찮다;;
문제 자체는 쉬움.

Greedy Gift Givers

A group of NP (2 ≤ NP ≤ 10) uniquely named friends has decided to exchange gifts of money. Each of these friends might or might not give some money to any or all of the other friends. Likewise, each friend might or might not receive money from any or all of the other friends. Your goal in this problem is to deduce how much more money each person gives than they receive.

The rules for gift-giving are potentially different than you might expect. Each person sets aside a certain amount of money to give and divides this money evenly among all those to whom he or she is giving a gift. No fractional money is available, so dividing 3 among 2 friends would be 1 each for the friends with 1 left over -- that 1 left over stays in the giver's "account".

In any group of friends, some people are more giving than others (or at least may have more acquaintances) and some people have more money than others.

Given a group of friends, no one of whom has a name longer than 14 characters, the money each person in the group spends on gifts, and a (sub)list of friends to whom each person gives gifts, determine how much more (or less) each person in the group gives than they receive.


The grader machine is a Linux machine that uses standard Unix conventions: end of line is a single character often known as '\n'. This differs from Windows, which ends lines with two charcters, '\n' and '\r'. Do not let your program get trapped by this!



Line 1: The single integer, NP
Lines 2..NP+1: Each line contains the name of a group member
Lines NP+2..end: NP groups of lines organized like this:
The first line in the group tells the person's name who will be giving gifts.
The second line in the group contains two numbers: The initial amount of money (in the range 0..2000) to be divided up into gifts by the giver and then the number of people to whom the giver will give gifts, NGi (0 ≤ NGi ≤ NP-1).
If NGi is nonzero, each of the next NGi lines lists the the name of a recipient of a gift.

+ Recent posts