Common Board Edited by author 05.03.2017 21:25 Во фрипаскале кейс не принимает стринги, насколько я помню. Попробуйте через ифы: if (a[i] = 'a1') or (a[i] = 'a8') и тд. #include "iostream" using namespace std; int main() { int a, b, rz; cin >> a >> b; if (b == 2 && a != 1 || b == 1 && a != 1) { rz = 2 * a / b; } else { if (a % b != 0) { rz = 2 * (a / b + 1); } else { rz = 2 * a / b; } } cout << rz; return 0; } i tested it a lot, pleas help may be i am so silly.... Hello) I can't understand how to work with n = 2^1 000 000, cause it's very big number. I think, this problem can be solved at stage of converting entered number, but don't know exactly how) I understood. The right way is not at converting entered binary number to decimal. Problem had tied on the fact that i used tokeniser for numbers and buffered reader for strings, Now i'm using bf reader for both strings and numbers and it gets AC. I leave it here, maybe it will useful Edited by author 05.03.2017 01:23 I checked everything 100 times but still can not understand what the problem is.(i wrote on Java) Perhaps, you don't sort the result? The same problem! What is the Test 2? Can anybody help with test 2 please? I have got this problem because i forgot to sort neighbours of vertices. ??? solved. you should calculate everything in int64 not doubles Never mind, found it-it could be when no item is marked in requirement string. Can I solve this problem by natural merge sort? I solved it via following approach, split array by incrementing sub sequencies (incrementing by 1) and join it back after sorting. For example 5 1 3 2 4 Will be splited by (5) (1 2) (3 4). After sort it by first element (5) (1 2) (3 4) => (1 2) (3 4) (5) After that all sequences on odd position gos to way #1 and all other to way #2 We will have (1 2 5) in way#1 and (3 4) in way#2 and trust order in array. we will have (5 1 2) in way#1 and (3 4) in way#2. And after join in will be (5 1 2 3 4). Iterate such approach till not get (1 .. N) Example of output for N=16 and decreasing array. 4 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 15 13 11 9 7 5 3 1 16 14 12 10 8 6 4 2 13 9 5 1 14 10 6 2 15 11 7 3 16 12 8 4 9 1 10 2 11 3 12 4 13 5 14 6 15 7 16 8 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 public class Pan { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int n = scanner.nextInt(); int k = scanner.nextInt(); int m = 2*n; if (m%k == 0){ System.out.println(m/k); } else{ System.out.println(m/k+1); } } } why Wrong Answer? Is test #6 checking something interesting, or is it just precision-test? At least, which solid is used in this test? const long double eps=1e-12; using long double... RT what's the principle of the solution? i've tried to construct laser-lines one after another with the smallest distance, and then to find dots of intersections line[i] and line[i+1], then find intersection of line[i+1] and line[i+2] and after that find the distance between dot[1] and dot[2], dot[2] and dot[3] and so on. But that's a big problem: line[i] can intersect line[i+1] in dot[1], that can later occur outside of the figure, formed with intersects of line[i+1000] and line[i+1001]. What's the solution? you can try to find intersection point of lines x1,y1, x2,y2 x1+dt*cos(theta1),y1+dt*sin(theta1),x2+dt*cos(theta2), y2+dt*sin(theta2) x1=fx1+t*cos(theta1),y1=fy1+t*sin(theta1) x2=fx2+t*cos(theta2),y2=fy2+t*sin(theta2) point (fx1,fy1) and (fx2,fy2) is the point on the convex polygon you can the intersection point x(t),y(t) by limit dt--->0 then length of args is sqrt((dx/dt)^+(dy/dt)^2) dt ,you can find the Primitive function of sqrt((dx/dt)^+(dy/dt)^2) and compute the integral by O(1) 1. Segment tree. 2. Fenwick tree. 3. Partial sums (b[i] = SUM(a[0], ..., a[i])). 4. Sqrt decomposition. Hope, it helps to understand how to solve this task. Edited by author 28.02.2017 15:25 1. Modification of a deque, which allows to find a min element in O(1). 2. Segment tree. 3. Min/max heap (was too slow for me). 4. Sparse table. 5. Sqrt decomposition. Hope, it helps to understand how to solve this task. Edited by author 28.02.2017 15:25 first using Heuristic search, a[x][y]<255-a[x][y] first search 0, else first serach 255, times>1e5 break; if ok==false using random search, if(rand()%2==0) first search 0 else first search 1, if you use rand()%2==1 first search 0 it will tle... for accepting you should consider something like long long int as input and ... but w7 is something different can anybody help for this... I got WA #7 as well.. not sure what went wrong anyone has the input n and expected output? Thanks Ok, I figured it out. Internal cache values should be long long for storing large count. For n = 500 answer = 732986521245023 My AC solution runs about 10 seconds for test case 1, 2, ...., 2000 on my laptop (it's an old one, though, maybe that's the reason). Could anyone give a hint about Test 12? What does it look like? Some possible overflow, etc. My program returns correct answer on 10000 10000 test. @Admins, can you please provide me with JUST an answer for this test? If so, my e-mail: dostoyevsky_at_ukr.net. Thanks a lot. Got AC. Made a mistake in printing long number — need no print leading zeros for non-top parts of number whats wrong? program fly; const okn='window'; ser='neither'; proh='aisle'; var i,r,n,bb:integer; s,s1:string; m:char; begin readln(s); n:=length(s); m:=s[n]; s1:=s; delete(s1,n,1); val(s1,r,bb); if r<3 then if (m='A') or (m='D') then writeln(okn) else writeln(proh) else if r<21 then if (m='A') or (m='F') then writeln(okn) else writeln(proh) else if r<65 then if (m='A') or (m='K') then writeln(okn) else if (m='C') or (m='D') or (m='G') or (m='H') then writeln(proh) else writeln(ser); end. Give me a test or something... За что отвечает тест 5? Задача 1005 "Куча камней" никак его не пропускает Edited by author 22.02.2017 21:21 |
|