ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1576. Telephone Tariffs

WA #5
Posted by Yermakov Alex <ONPU> 2 May 2010 00:25
#include <stdio.h>
int main()
{
    int n1,c1,n2,t,c2,n3,k,i;
    scanf("%d %d",&n1,&c1);
    scanf("%d %d %d",&n2,&t,&c2);
    scanf("%d",&n3);
    scanf("%d",&k);
    int (*A)[2] = new int[k][2];
    for( i=0; i<k; ++i )
    {
         scanf("%d:%d",&A[i][0],&A[i][1]);
    }
    int basic = n1,combined = n2,unlimited = n3,bas=0,com=0;

    for( i=0; i<k; ++i )
    {
         if(A[i][0]!=0)
         {
                        bas+=A[i][0]; com+=A[i][0];
         }
         if( (A[i][0]==0 && A[i][1]>6) || (A[i][0]!=0 && A[i][1]!=0 ) ) { ++bas; ++com; }
    }
    if ( com>t )
         {
               com-=t; com*=c2;
         }
    bas *= c1;
    basic += bas; combined += com;

    printf("Basic:     %d\n",basic);
    printf("Combined:  %d\n",combined);
    printf("Unlimited: %d\n",unlimited);
    delete [] A;
    return 0;
}
Re: WA #5
Posted by Sergey Lazarev (MSU Tashkent) 2 May 2010 01:14
Test:

135 1
220 10 1
300
5
00:05
00:10
00:59
05:00
01:01

Answer:

Basic:     144
Combined:  220
Unlimited: 300
Re: WA #5
Posted by Yermakov Alex <ONPU> 2 May 2010 01:58
Combined in this test must be 221... because 00:10 gives 1 minute , 00:59 give 1 minute , 05:00 gives 5, 01:01 gives 2...or... 01:01 gives 1 minute or 2 minutes ??
Re: WA #5
Posted by Sergey Lazarev (MSU Tashkent) 2 May 2010 11:31
00:10 - 1 minute;
00:59 - 1 minute;
05:00 - 5 minutes;
01:01 - 2 minutes.
All time is 9 minutes.

In this test you are allowed to talk up to 10 minutes per month for free. You talked only 9. So you should pay only monthly fee - 220.
Re: WA #5
Posted by Yermakov Alex <ONPU> 4 May 2010 21:02
Yes , thanks . I should write
[ else com=0 ]
after
 [ if(com > t){...} ]