Task: | Rain Fall |
Sender: | PILIPOJAT!! |
Submission time: | 2016-10-04 17:53:43 +0300 |
Language: | Java |
Status: | READY |
Result: | ACCEPTED |
test | verdict | time | |
---|---|---|---|
#1 | ACCEPTED | 0.12 s | details |
#2 | ACCEPTED | 0.15 s | details |
#3 | ACCEPTED | 0.14 s | details |
#4 | ACCEPTED | 0.12 s | details |
#5 | ACCEPTED | 0.14 s | details |
#6 | ACCEPTED | 0.11 s | details |
#7 | ACCEPTED | 0.12 s | details |
#8 | ACCEPTED | 0.12 s | details |
#9 | ACCEPTED | 0.14 s | details |
#10 | ACCEPTED | 0.11 s | details |
#11 | ACCEPTED | 0.14 s | details |
#12 | ACCEPTED | 0.14 s | details |
#13 | ACCEPTED | 0.11 s | details |
#14 | ACCEPTED | 0.16 s | details |
#15 | ACCEPTED | 0.15 s | details |
#16 | ACCEPTED | 0.12 s | details |
#17 | ACCEPTED | 0.12 s | details |
#18 | ACCEPTED | 0.14 s | details |
#19 | ACCEPTED | 0.15 s | details |
#20 | ACCEPTED | 0.09 s | details |
#21 | ACCEPTED | 0.11 s | details |
#22 | ACCEPTED | 0.15 s | details |
#23 | ACCEPTED | 0.12 s | details |
#24 | ACCEPTED | 0.12 s | details |
#25 | ACCEPTED | 0.14 s | details |
#26 | ACCEPTED | 0.12 s | details |
#27 | ACCEPTED | 0.13 s | details |
#28 | ACCEPTED | 0.11 s | details |
#29 | ACCEPTED | 0.13 s | details |
#30 | ACCEPTED | 0.13 s | details |
#31 | ACCEPTED | 0.13 s | details |
#32 | ACCEPTED | 0.13 s | details |
#33 | ACCEPTED | 0.12 s | details |
#34 | ACCEPTED | 0.14 s | details |
#35 | ACCEPTED | 0.12 s | details |
#36 | ACCEPTED | 0.12 s | details |
Code
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ //package cses; import java.util.*; import java.io.*; /** * * @author eamiller */ public class Cses { public static void main(String[] args) { IO io = new IO(); double l = io.nextDouble(); double k = io.nextDouble(); double t1 = io.nextDouble(); double t2 = io.nextDouble(); double h = io.nextDouble(); double a = (-1)*(k / t1); double b = (h/t1 + k + (t2/t1)*k); double c = (-1)*l; double tx1 = ((-1)*b + Math.sqrt(Math.pow(b, 2) - 4*a*c)) / (2*a); // double tx2 = ((-1)*b - Math.sqrt(Math.pow(b, 2) - 4*a*c)) // / (2*a); double s1 = l/tx1;//SADETAHTI // double s2 = l/tx2; double f2 = s1 * t1; double f1 = f2; if(h < l){ f2 = h; f1 = h; }else if(h == l){ f1 = h; } System.out.println(f1 + " " + f2); } public static class IO extends PrintWriter { private InputStreamReader r; private static final int BUFSIZE = 1 << 15; private char[] buf; private int bufc; private int bufi; private StringBuilder sb; public IO() { super(new BufferedOutputStream(System.out)); r = new InputStreamReader(System.in); buf = new char[BUFSIZE]; bufc = 0; bufi = 0; sb = new StringBuilder(); } private void fillBuf() throws IOException { bufi = 0; bufc = 0; while(bufc == 0) { bufc = r.read(buf, 0, BUFSIZE); if(bufc == -1) { bufc = 0; return; } } } private boolean pumpBuf() throws IOException { if(bufi == bufc) { fillBuf(); } return bufc != 0; } private boolean isDelimiter(char c) { return c == ' ' || c == '\t' || c == '\n' || c == '\r' || c == '\f'; } private void eatDelimiters() throws IOException { while(true) { if(bufi == bufc) { fillBuf(); if(bufc == 0) throw new RuntimeException("IO: Out of input."); } if(!isDelimiter(buf[bufi])) break; ++bufi; } } public String next() { try { sb.setLength(0); eatDelimiters(); int start = bufi; while(true) { if(bufi == bufc) { sb.append(buf, start, bufi - start); fillBuf(); start = 0; if(bufc == 0) break; } if(isDelimiter(buf[bufi])) break; ++bufi; } sb.append(buf, start, bufi - start); return sb.toString(); } catch(IOException e) { throw new RuntimeException("IO.next: Caught IOException."); } } public int nextInt() { try { int ret = 0; eatDelimiters(); boolean positive = true; if(buf[bufi] == '-') { ++bufi; if(!pumpBuf()) throw new RuntimeException("IO.nextInt: Invalid int."); positive = false; } boolean first = true; while(true) { if(!pumpBuf()) break; if(isDelimiter(buf[bufi])) { if(first) throw new RuntimeException("IO.nextInt: Invalid int."); break; } first = false; if(buf[bufi] >= '0' && buf[bufi] <= '9') { if(ret < -214748364) throw new RuntimeException("IO.nextInt: Invalid int."); ret *= 10; ret -= (int)(buf[bufi] - '0'); if(ret > 0) throw new RuntimeException("IO.nextInt: Invalid int."); } else { throw new RuntimeException("IO.nextInt: Invalid int."); } ++bufi; } if(positive) { if(ret == -2147483648) throw new RuntimeException("IO.nextInt: Invalid int."); ret = -ret; } return ret; } catch(IOException e) { throw new RuntimeException("IO.nextInt: Caught IOException."); } } public long nextLong() { try { long ret = 0; eatDelimiters(); boolean positive = true; if(buf[bufi] == '-') { ++bufi; if(!pumpBuf()) throw new RuntimeException("IO.nextLong: Invalid long."); positive = false; } boolean first = true; while(true) { if(!pumpBuf()) break; if(isDelimiter(buf[bufi])) { if(first) throw new RuntimeException("IO.nextLong: Invalid long."); break; } first = false; if(buf[bufi] >= '0' && buf[bufi] <= '9') { if(ret < -922337203685477580L) throw new RuntimeException("IO.nextLong: Invalid long."); ret *= 10; ret -= (long)(buf[bufi] - '0'); if(ret > 0) throw new RuntimeException("IO.nextLong: Invalid long."); } else { throw new RuntimeException("IO.nextLong: Invalid long."); } ++bufi; } if(positive) { if(ret == -9223372036854775808L) throw new RuntimeException("IO.nextLong: Invalid long."); ret = -ret; } return ret; } catch(IOException e) { throw new RuntimeException("IO.nextLong: Caught IOException."); } } public double nextDouble() { return Double.parseDouble(next()); } } }
Test details
Test 1
Verdict: ACCEPTED
input |
---|
80.00 0.50 2.00 1.50 80.00 |
correct output |
---|
80.000000000 80.759403280 |
user output |
---|
80.0 80.75940327997895 |
Test 2
Verdict: ACCEPTED
input |
---|
100.00 0.50 2.00 1.50 80.00 |
correct output |
---|
80.000000000 80.000000000 |
user output |
---|
80.0 80.0 |
Test 3
Verdict: ACCEPTED
input |
---|
150.00 1.00 100.00 150.00 100.... |
correct output |
---|
100.000000000 100.000000000 |
user output |
---|
100.0 100.0 |
Test 4
Verdict: ACCEPTED
input |
---|
150.00 1.00 100.00 150.00 150.... |
correct output |
---|
150.000000000 358.113883008 |
user output |
---|
150.0 358.11388300841907 |
Test 5
Verdict: ACCEPTED
input |
---|
150.00 1.00 100.00 15.00 415.0... |
correct output |
---|
500.000000000 500.000000000 |
user output |
---|
500.0000000000003 500.00000000... |
Test 6
Verdict: ACCEPTED
input |
---|
50.00 5.00 2.00 2.00 40.00 |
correct output |
---|
40.000000000 40.000000000 |
user output |
---|
40.0 40.0 |
Test 7
Verdict: ACCEPTED
input |
---|
50.00 5.00 2.00 2.00 50.00 |
correct output |
---|
50.000000000 61.925824036 |
user output |
---|
50.0 61.92582403567252 |
Test 8
Verdict: ACCEPTED
input |
---|
50.00 5.00 2.00 2.00 65.00 |
correct output |
---|
78.642080737 78.642080737 |
user output |
---|
78.64208073700242 78.642080737... |
Test 9
Verdict: ACCEPTED
input |
---|
10.00 1.00 3.00 3.00 3.00 |
correct output |
---|
3.000000000 3.000000000 |
user output |
---|
3.0 3.0 |
Test 10
Verdict: ACCEPTED
input |
---|
10.00 1.00 3.00 3.00 10.00 |
correct output |
---|
10.000000000 13.830951895 |
user output |
---|
10.0 13.830951894845303 |
Test 11
Verdict: ACCEPTED
input |
---|
10.00 1.00 3.00 3.00 16.00 |
correct output |
---|
20.539392014 20.539392014 |
user output |
---|
20.53939201416945 20.539392014... |
Test 12
Verdict: ACCEPTED
input |
---|
10.00 1.00 3.00 3.00 25.00 |
correct output |
---|
30.000000000 30.000000000 |
user output |
---|
30.00000000000003 30.000000000... |
Test 13
Verdict: ACCEPTED
input |
---|
10.00 1.00 3.00 3.00 33.00 |
correct output |
---|
38.214967272 38.214967272 |
user output |
---|
38.21496727221288 38.214967272... |
Test 14
Verdict: ACCEPTED
input |
---|
1.00 2.00 3.00 2.00 5.00 |
correct output |
---|
14.588723439 14.588723439 |
user output |
---|
14.588723439378885 14.58872343... |
Test 15
Verdict: ACCEPTED
input |
---|
6.00 2.00 3.00 2.00 7.00 |
correct output |
---|
14.520797289 14.520797289 |
user output |
---|
14.52079728939615 14.520797289... |
Test 16
Verdict: ACCEPTED
input |
---|
11.00 2.00 3.00 2.00 11.00 |
correct output |
---|
11.000000000 17.152067348 |
user output |
---|
11.0 17.15206734782503 |
Test 17
Verdict: ACCEPTED
input |
---|
16.00 2.00 3.00 2.00 15.00 |
correct output |
---|
15.000000000 15.000000000 |
user output |
---|
15.0 15.0 |
Test 18
Verdict: ACCEPTED
input |
---|
21.00 2.00 3.00 2.00 15.00 |
correct output |
---|
15.000000000 15.000000000 |
user output |
---|
15.0 15.0 |
Test 19
Verdict: ACCEPTED
input |
---|
26.00 2.00 3.00 2.00 15.00 |
correct output |
---|
15.000000000 15.000000000 |
user output |
---|
15.0 15.0 |
Test 20
Verdict: ACCEPTED
input |
---|
31.00 2.00 3.00 2.00 15.00 |
correct output |
---|
15.000000000 15.000000000 |
user output |
---|
15.0 15.0 |
Test 21
Verdict: ACCEPTED
input |
---|
25.00 2.00 1.00 1.00 10.00 |
correct output |
---|
10.000000000 10.000000000 |
user output |
---|
10.0 10.0 |
Test 22
Verdict: ACCEPTED
input |
---|
25.00 2.00 1.00 2.00 10.00 |
correct output |
---|
10.000000000 10.000000000 |
user output |
---|
10.0 10.0 |
Test 23
Verdict: ACCEPTED
input |
---|
25.00 2.00 1.00 3.00 10.00 |
correct output |
---|
10.000000000 10.000000000 |
user output |
---|
10.0 10.0 |
Test 24
Verdict: ACCEPTED
input |
---|
25.00 2.00 2.00 1.00 20.00 |
correct output |
---|
20.000000000 20.000000000 |
user output |
---|
20.0 20.0 |
Test 25
Verdict: ACCEPTED
input |
---|
25.00 2.00 2.00 2.00 20.00 |
correct output |
---|
20.000000000 20.000000000 |
user output |
---|
20.0 20.0 |
Test 26
Verdict: ACCEPTED
input |
---|
25.00 2.00 2.00 3.00 20.00 |
correct output |
---|
20.000000000 20.000000000 |
user output |
---|
20.0 20.0 |
Test 27
Verdict: ACCEPTED
input |
---|
25.00 2.00 3.00 1.00 26.00 |
correct output |
---|
28.789826123 28.789826123 |
user output |
---|
28.789826122551602 28.78982612... |
Test 28
Verdict: ACCEPTED
input |
---|
25.00 2.00 3.00 2.00 25.00 |
correct output |
---|
25.000000000 30.000000000 |
user output |
---|
25.0 30.00000000000001 |
Test 29
Verdict: ACCEPTED
input |
---|
25.00 2.00 3.00 3.00 25.00 |
correct output |
---|
25.000000000 32.365424624 |
user output |
---|
25.0 32.365424623862054 |
Test 30
Verdict: ACCEPTED
input |
---|
25.00 2.00 4.00 1.00 34.00 |
correct output |
---|
38.852299546 38.852299546 |
user output |
---|
38.852299546352725 38.85229954... |
Test 31
Verdict: ACCEPTED
input |
---|
25.00 2.00 4.00 2.00 32.00 |
correct output |
---|
38.852299546 38.852299546 |
user output |
---|
38.852299546352725 38.85229954... |
Test 32
Verdict: ACCEPTED
input |
---|
25.00 2.00 4.00 3.00 30.00 |
correct output |
---|
38.852299546 38.852299546 |
user output |
---|
38.852299546352725 38.85229954... |
Test 33
Verdict: ACCEPTED
input |
---|
25.00 2.00 3.00 2.00 25.00 |
correct output |
---|
25.000000000 30.000000000 |
user output |
---|
25.0 30.00000000000001 |
Test 34
Verdict: ACCEPTED
input |
---|
25.00 2.00 3.00 3.00 25.00 |
correct output |
---|
25.000000000 32.365424624 |
user output |
---|
25.0 32.365424623862054 |
Test 35
Verdict: ACCEPTED
input |
---|
5.00 7.00 0.01 2.00 6.00 |
correct output |
---|
20.052545857 20.052545857 |
user output |
---|
20.052545857145308 20.05254585... |
Test 36
Verdict: ACCEPTED
input |
---|
0.01 1000.00 1000.00 1000.00 1... |
correct output |
---|
2000999.995002499 2000999.9950... |
user output |
---|
2000999.9939961536 2000999.993... |