CCC '05 J1 - The Cell Sell

View as PDF

Submit solution


Points: 3
Time limit: 2.0s
Memory limit: 64M

Problem type

Moe Bull has a cell phone and after a month of use is trying to decide which price plan is the best for his usage pattern. He has two options, each plan has different costs for daytime minutes, evening minutes and weekend minutes.

Plan Costs
daytime evening weekend
A 100 free minutes then 25 cents per minute 15 cents per minute 20 cents per minute
B 250 free minutes then 45 cents per minute 35 cents per minute 25 cents per minute

Write a program that will input the number of each type of minutes and output the cheapest plan for this usage pattern, using the format shown below. The input will be in the order of daytime minutes, evening minutes and weekend minutes. In the case that the two plans are the same price, output both plans.

Sample Input 1

251
10
60

Sample Output 1

Plan A costs 51.25
Plan B costs 18.95
Plan B is cheapest.

Sample Input 2

162
61
66

Sample Output 2

Plan A costs 37.85
Plan B costs 37.85
Plan A and B are the same price.

CCC problem statements in large part from the PEG OJ


Comments


  • 0
    saysuhayl  commented on Oct. 14, 2018, 12:31 a.m.

    Spent 20 mins debugging because the output is worded "Plan B is cheapest." vs "Plan B is the cheapest." which is proper grammar.


  • 0
    DKLS2  commented on May 31, 2018, 12:18 p.m.

    I


  • -2
    dawangk  commented on May 25, 2018, 9:51 p.m.

    AC for only first case

    Can someone help me on this?


  • 0
    owenzhu2012  commented on Feb. 8, 2018, 9:06 p.m.

    For some reason my program doesn't work for test case 2 don't know why.


  • -3
    Dordor1218  commented on Feb. 2, 2018, 8:04 p.m. edit 4

    This problem is hard!


  • 0
    mrglioula  commented on Nov. 12, 2017, 8:12 a.m.

    what is wrong with my prog pllz


    • 0
      haytam  commented on Nov. 12, 2017, 2:21 p.m. edited

      you wrote

      cout<<"Plan A costs "<<(1/10.0)*m<<endl;
      cout<<"Plan B costs "<<(1/10.0)*n<<endl;
      cout<<"Plan A is cheapest.";

      but you need to write

       cout<<"Plan A costs "<<m/100<<endl;
      cout<<"Plan B costs "<<n/100<<endl;
      cout<<"Plan A is cheapest.";

      note !: mkelekh detected


  • 0
    Epic1Online  commented on Oct. 30, 2017, 5:11 p.m. edit 2

    Are compile errors due to bad code? Because my code works on my laptop but I get a compile error when submitting. The same thing happened for another problem but I resubmitted and it worked but that's not fixing the error here.

    EDIT: I fixed it by using Math.round() instead of DecimalFormat, but I don't see why DecimalFormat shouldn't work (Java 8)


    • 3
      Injust  commented on Oct. 30, 2017, 6:41 p.m.

      You may want to import java.text.DecimalFormat.


  • 0
    Selena_Liu  commented on July 12, 2017, 12:51 a.m.

    I don't get why my first case is wrong. They are the same price, aren't they?


    • 5
      Injust  commented on July 12, 2017, 3:35 a.m.

      Your program prints Plan A and Plan B are the same price. when the plans cost the same amount.


  • -8
    lolzballs  commented on March 18, 2015, 1:16 p.m.
    Is cheapest?

    Is "Plan A is cheapest" correct grammar? I spent a while debugging my code because of this. I put "Plan A is the cheapest" instead.

    And then I 'fixed' it to "Plan A is cheaper".


    • 1
      FatalEagle  commented on March 18, 2015, 1:17 p.m.

      How correct the grammar is doesn't matter; it's simply the output specifications.


  • -1
    Hunterdrago1  commented on Oct. 18, 2014, 6:31 p.m.
    What my output looks like when I input Sample Input 2... Are we allowed to round?

    Plan A costs 37.85 Plan B costs 37.849999999999994 Plan B is cheapest.


    • -4
      FatalEagle  commented on Nov. 1, 2014, 12:17 a.m.

      We are dealing with exact real numbers in this problem.


      • -5
        Miss  commented on Nov. 19, 2014, 2:05 p.m.

        Meaning rounding is or isn't allowed?


        • -3
          FatalEagle  commented on Nov. 19, 2014, 6:47 p.m.

          The answer must be to exactly 2 decimal places. The constraints are such that the correct answer will not have any nonzero digits after and including the third decimal place.


  • 0
    Zhenpai  commented on Oct. 7, 2014, 9:41 p.m.

    I think there's a problem with your problem, and I have a problem with that.


    • 1
      quantum  commented on Oct. 7, 2014, 10:22 p.m.

      There is no problem with this problem.


      • 1
        moladan123  commented on Dec. 1, 2014, 3:27 p.m.

        I have a problem with this objection.


        • -12
          steePHAN  commented on May 22, 2015, 11:18 a.m.

          I have problem with the problem with this objection


          • -4
            Dordor1218  commented on Feb. 2, 2018, 8:05 p.m.

            I have a problem with the problem with the problem with this objection


            • -4
              CowTrainer  commented on Feb. 4, 2018, 8:36 p.m.

              I have a problem with the problem with the problem with the problem with this objection


              • -1
                nikos  commented on May 26, 2018, 10:41 a.m.

                I have a problem with the fact that everyone has problems with the problem and problems with the problem with the problem. And the all the objections and problems with them.


                • -1
                  Raymo111  commented on Aug. 7, 2018, 11:22 a.m.

                  Y'all have problems


                  • 0
                    xxsc  commented on Aug. 26, 2018, 12:04 p.m.

                    hey, just saying, what's with these downvotes?