Ejemplo n.º 1
0
  public void invite(Person person) {
    if (peopleInvited == 0) for (int tshirt : person.getAllTshirts()) waysBuffer[tshirt] = 1;
    else {
      for (int tshirt = 1; tshirt < Person.TSHIRT_LIMIT; tshirt++) {
        // waysToPartyWithT = ways[tshirt];
        // waysToPartyWithout = waysToParty - waysToPartyWithT;
        // ways[tshirt] = waysWithoutT * 1 + waysWithT * (totalTshirts - 1);

        if (person.has(tshirt))
          waysBuffer[tshirt] =
              ModMath.add(
                  waysToParty, ModMath.mul((long) (person.getTshirtCount() - 2), ways[tshirt]));
        else waysBuffer[tshirt] = ModMath.mul(ways[tshirt], (long) person.getTshirtCount());
      }
    }

    peopleInvited++;
    waysToParty = getNewWaysToParty(person, waysToParty);
    for (int i = 0; i < ways.length; i++) ways[i] = waysBuffer[i];

    System.err.println("Invited " + person.toString());
    for (int i = 0; i < 20; i++) System.err.print(ways[i] + " ");
    System.err.println("| " + waysToParty);
  }
Ejemplo n.º 2
0
 public String getMotherName() {
   return mother.toString();
 }