Codeforces celebrates 10 years! We are pleased to announce the crowdfunding-campaign. Congratulate us by the link https://codeforces.com/10years. ×

selfcompiler's blog

By selfcompiler, history, 3 years ago, In English,

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 ?

 
 
 
 
  • Vote: I like it
  • +3
  • Vote: I do not like it

»
3 years ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

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 :)

  • »
    »
    3 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

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

    • »
      »
      »
      3 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

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