Блог пользователя selfcompiler

Автор selfcompiler, история, 8 лет назад, По-английски

Every Friday night, Alice, Clara and Mary go to Koerner’s pub to relax after a long week. At the pub, lots of guys ask them for their phone numbers. In fact, the three ladies are so popular that they have started counting the number of times each one is asked for her phone number during one evening. On day i, Alice, Clara and Mary were asked Ai , Ci and Mi times, respectively. 100 Fridays have passed, and the records were lost, but there are 3 things Alice still remembers. 1. X of the 100 days, Ai was equal to Ci . 2. Y of the 100 days, Ci was equal to Mi . 3. Z of the 100 days, Ai was equal to Mi

I want to find out the how many maximum and minimum no of day Ai,Bi,Ci will be equal ?

I tried to use inclusion exclusion principle not able to get it exactly how to apply here ?

  • Проголосовать: нравится
  • +3
  • Проголосовать: не нравится

»
8 лет назад, # |
Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

Just think simple. Let a = (x + y + z - 100 + 1) / 2 and b = min(x, min(y, z)). If x + y + z < 100 then a=0 (else it'll be negative number). Then check if a <  = b print a and b, else there is something wrong. Good luck :)

  • »
    »
    8 лет назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    why you took a = (x + y + z - 100 + 1) / 2 ,can you please explain ?

    • »
      »
      »
      8 лет назад, # ^ |
        Проголосовать: нравится 0 Проголосовать: не нравится

      From set theory, (x - a) + (y - a) + (z - a) + a ≤ 100 then you get value of a