Show all threads Hide all threads Show all messages Hide all messages |
rounding in python is easy | yyll | 1300. Taxes | 28 May 2022 13:02 | 1 |
You can just do calculations with floats as much as possible, e.g., 15% = 0.15, binary search with epsilon = 0.0001. Rounding with round(x, 2) are needed only when: 1. K*L 2. output of T(K) -- "The calculation of the regional coefficient and all kinds the taxes is made with rounding off to two digits after a decimal point." while K itself is float. |
m can be zero | bsu.mmf.team | 1300. Taxes | 3 Mar 2021 22:08 | 1 |
A test like this is possible: 15 0 35 12000000 12000000 -1 First time it occurs in Test 9. This means that you should pay the same tax for any amount of salary. It is ok to output 0.00 for all such tests, despite it is not correct always because of interim roundings of regional coefficient. Everything else is well-described in previous comments, basically correct numbers round and correct searching of initial salary (you should search for max possible value with 2 decimal places in it) are the only things that can make the initial problem description being unclear. |
WA 7 | Vasilenko Oleg (South Ural State University) | 1300. Taxes | 7 Apr 2010 20:48 | 1 |
WA 7 Vasilenko Oleg (South Ural State University) 7 Apr 2010 20:48 I apply rounding (as floor(x*100+0.5)/100) only to RESULT of T(R) and to regional coefficient. But I can't pass test 7. Can anybody help me? |
Problem 1300 is UNFAIR! | Walrus | 1300. Taxes | 8 Dec 2008 12:36 | 5 |
In this problem we need to calculate R(S): F(R) = S, where F(R) = R – T(R) + L%*R – T(L%*R). But function F(R) is NOT increase monotonically! In other words, it is possible to find R: F(R) = F(R+1). So, it is impossible to calculate unique R(S). Example: 99 1000000000 10 2000000000 40 3000000000 41 0 77 100000000 2000000000 3000000000 4200000000 5000000000 1100000001 2200000000 3300000001 -1 If in your program R(S) = max{R: F(R) = S} then answer = 11086345330.78 (and you'll get AC) If in your program R(S) = min{R: F(R) = S} then answer = 11086345330.81 (and you'll get WA #7) Also your program can write another answers. Which of they are correct? And why? Admins. I think Walrus is right. may be need to change a statement... It is mathematical situation and not of statement. max{R: F(R) = S} may be =1/3 and approxed by double with eps. After rounding this eps may convert 0.4999999999~0.0 in 0.5000000000001~1. Thus we must solve the problem above fractions __int64/_int64. Got Ac when R is double but after floor(R*100+0.5)/100 This problem is another example that in double calculations we need in description of the author algorithm. Edited by author 26.08.2009 12:56 There is no fractions. I just used int64. :) Suggestion to find R(S) = max{R: F(R) = S} must be added with information: In what class of numbers should we seach of the S? 1) Numbers of pattern ########.## - rubles and copeys 2) All real numbers |
rounding...(problem#1300) | Alexander Prudaev | 1300. Taxes | 6 Mar 2006 18:48 | 2 |
i can't understand, why, where, and how I must round intermediate results. I try it all, but got WA on test 1..3 please help me!!! or you can send me AC program, that i may understand this condition. my e-mail: twoalias [Alfa] inbox.ru |
Give the decision, very much it is necessary (Course). | Ufo | 1300. Taxes | 22 Oct 2005 07:27 | 1 |
Please, throw the decision these are problems on e-mail: ufo.nix@mail.ru Would make itself, but now a blockage on study... I am not in time..:-( |
What is the "Crash (FLT_STACK_CHECK)" | ACM.Anatoliy 'Tolyan_NO' Tolstobroff | 1300. Taxes | 4 Oct 2005 23:47 | 1 |
What is it? I first got it. And what do with it? If you whant I can give you my code mailto: tolik-tol@inbox.ru |
I know why the % of AC is low... | Yu Yuanming | 1300. Taxes | 5 Jun 2005 19:12 | 1 |
The algo is easy, but you must read the problem's description very carefully, and take care of rounding: r = int(r * 100 + 0.5) / 100, use it when calc tax and add up... Because of rounding, it takes me almost one day to AC this problem...:( |
WA2 | Samun_Victor [SESC USU] | 1300. Taxes | 5 Jun 2005 13:20 | 2 |
WA2 Samun_Victor [SESC USU] 5 Jun 2005 11:50 my source: (Pascal) begin end. I need get WA1, but I get WA2. What is it? A bug? |
Help! | figo | 1300. Taxes | 5 Sep 2004 15:31 | 1 |
Help! figo 5 Sep 2004 15:31 My program always wrong, but I don't know why, if you got AC, can you send me your program? |
Some questions | Scythe (Berinde Radu) | 1300. Taxes | 10 Aug 2004 12:57 | 3 |
I do not understand how the rounding occurs. First of all is it a floor(x*100)/100 (trunc-like) or a floor(x*100+0.5)/100 (round-like)? When does it occur? At any operation other than addition? For example, when computing the taxes for some value, the result is rounded at every segment (where percentage is applied) or only after the summation? When computing T(R*L%), R*L% is rounded before computations or not? The gross profit for each enterprise (the one we have to compute) is also with only 2 decimals? Rounding is floor(x*100+0.5)/100 It applies to result of T(K) and to regional coefficient. |
Any ideas about the sample and the tests. | Harry Potter | 1300. Taxes | 5 May 2004 18:19 | 2 |
I guess it is obvious that the sample and some of the test are COMPLETELY WRONG. Does anybody have an idea where does the sample answer come from? Any ideas that you'd like to share? I promise it is obvious that the sample and all of the test are COMPLETELY RIGHT . Maybe you misunderstood it . Notice that the money got from the companies is the "net profit", in other words,it's R-T(R)+R*L%-T(R*L%).So you should calculate R first according to the rules. |