|
|
вернуться в форумWA #5 #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 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 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 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 Yes , thanks . I should write [ else com=0 ] after [ if(com > t){...} ] |
|
|