|
|
Show all threads Hide all threads Show all messages Hide all messages | WA 18 | Yagudin Ruslan | 1942. Attack at the Orbit | 1 Dec 2015 21:45 | 3 | WA 18 Yagudin Ruslan 5 Jan 2013 22:50 I think fraction part. AC got q:=q*100000; q_int:=round(q) div 100; BUT WA 34 got q:=q*100000; q_int:=trunc(q) div 100; and q:=q*10000; q_int:=trunc(q) div 10; Here is test: 2 0.1 0 -1.9 0 ---------- 2 0.100000 | care about -0.0 | eycia | 1942. Attack at the Orbit | 29 Jul 2015 14:22 | 1 | | Fractional part detection | bsu.mmf.team | 1942. Attack at the Orbit | 28 Mar 2014 21:54 | 4 | I used this code: double x, y; cin >> x >> y; x *= 1000; y *= 1000; int X = (int)x, Y = (int)y; But this code doesn't work properly. For example, if x = -1.001, then X will be -1000 (in some cases one unit is lost). How to avoid this in C++? To solve this problem I had to read whole string and then parse it :) My method got AC: cin >> a; A = (int)(a*1000.000001); I use (g++11) double a; scanf("%lf",&a); p[j] = (int(a*1000.000001) + 100000) % 1000; "a*1000" gives WA "cin >> a" gives TL45 even with "cin.sync_with_stdio(false)" This task use some architectural float issues. So we need minimize to use real numbers. I try many times, but get AC only with manual parsing: x,y = sys.stdin.readline().strip().split() xs,ys = x.split('.'), y.split('.') x = int(xs[1]), y = int(ys[1]) if xs[0][0]=='-': x=-x if ys[0][0]=='-': y=-y I use float number only one time - in last line, in sqrt. | What does this mean? | Sure | 1942. Attack at the Orbit | 5 Jan 2013 17:03 | 12 | Who can explain "The captain can’t rotate the weapon aiming system.",please? The captain can't rotate angle Does it mean that the system can only shoot at targets both coordinates of which are integers on just one line? Edited by author 05.01.2013 15:25 What??Sorry, I can't see what you say. Edited by author 05.01.2013 15:54 "laser can shoot at targets both coordinates of which are integers" Any target with both integer coordinates in new coordinate system can be destroyed. Really? This ought to be one of the most confusing statements I've ever seen, if this is true... "The captain can’t rotate the weapon aiming system." How come I can be at point (0, 0) and shoot at (1, 0) and (0, 1) if I can't rotate the aiming system? You are not in point (0,0) - you are in the space near the planet. :) And all the points including (0,0) are on the planet's surface. Are you Sure? But I got Wrong Answer many times. If it is true, I think the second answer must be less than 0.5*sqrt(2). Am I right? Then is it true that every two pads can both be destroyed if they are equal after the decimal point? This is true, for example, for pads with positive coordinates. Pads (0.0, 0.3) and (0.0, -0.7) can both be destroyed too. | Clarification | forest | 1942. Attack at the Orbit | 5 Jan 2013 15:03 | 1 | Is it true that lazer beam should begin at origin ? | Real numbers | 2rf | 1942. Attack at the Orbit | 5 Jan 2013 13:07 | 1 | Is ".5" real number? Same question about "1." UPD: looks like ".5" is not, about "1." I'm not sure but there isn't much trouble with such numbers. Edited by author 05.01.2013 13:20 |
|
|
|