Task: | Number |
Sender: | PILIPOJAT!! |
Submission time: | 2016-10-04 17:07:20 +0300 |
Language: | Java |
Status: | READY |
Result: | TIME LIMIT EXCEEDED |
test | verdict | time | |
---|---|---|---|
#1 | TIME LIMIT EXCEEDED | -- | details |
#2 | ACCEPTED | 0.12 s | details |
#3 | ACCEPTED | 0.17 s | details |
#4 | ACCEPTED | 0.16 s | details |
#5 | ACCEPTED | 0.12 s | details |
#6 | ACCEPTED | 0.29 s | details |
#7 | ACCEPTED | 0.16 s | details |
#8 | ACCEPTED | 0.10 s | details |
#9 | ACCEPTED | 0.12 s | details |
#10 | ACCEPTED | 0.11 s | details |
#11 | ACCEPTED | 0.49 s | details |
#12 | ACCEPTED | 0.12 s | details |
#13 | ACCEPTED | 0.14 s | details |
#14 | ACCEPTED | 0.14 s | details |
#15 | ACCEPTED | 0.14 s | details |
#16 | ACCEPTED | 0.52 s | details |
#17 | ACCEPTED | 0.13 s | details |
#18 | ACCEPTED | 0.16 s | details |
#19 | ACCEPTED | 0.13 s | details |
#20 | ACCEPTED | 0.11 s | details |
#21 | TIME LIMIT EXCEEDED | -- | details |
#22 | ACCEPTED | 0.12 s | details |
#23 | ACCEPTED | 0.15 s | details |
#24 | ACCEPTED | 0.09 s | details |
#25 | ACCEPTED | 0.11 s | details |
#26 | TIME LIMIT EXCEEDED | -- | details |
#27 | ACCEPTED | 0.12 s | details |
#28 | ACCEPTED | 0.16 s | details |
#29 | ACCEPTED | 0.11 s | details |
#30 | ACCEPTED | 0.11 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(); */ long x = io.nextLong(); long a = io.nextLong(); long b = io.nextLong(); long tulos = 0; double asd = 1.0/b; while(x>0) { if(((double)(x-x/2)/a) >= asd) { tulos += a; x=x/2; } else { tulos += b; x--; } } System.out.println(tulos); } 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: TIME LIMIT EXCEEDED
input |
---|
804289384 846930887 8 |
correct output |
---|
3302440542 |
user output |
---|
(empty) |
Test 2
Verdict: ACCEPTED
input |
---|
714636916 957747794 424238336 |
correct output |
---|
27665414904 |
user output |
---|
27665414904 |
Test 3
Verdict: ACCEPTED
input |
---|
719885387 3 10 |
correct output |
---|
90 |
user output |
---|
90 |
Test 4
Verdict: ACCEPTED
input |
---|
189641422 189641422 189641422 |
correct output |
---|
5309959816 |
user output |
---|
5309959816 |
Test 5
Verdict: ACCEPTED
input |
---|
25202363 8 783368691 |
correct output |
---|
200 |
user output |
---|
200 |
Test 6
Verdict: ACCEPTED
input |
---|
102520060 44897764 7 |
correct output |
---|
224398341 |
user output |
---|
224398341 |
Test 7
Verdict: ACCEPTED
input |
---|
365180541 540383427 304089173 |
correct output |
---|
15198530875 |
user output |
---|
15198530875 |
Test 8
Verdict: ACCEPTED
input |
---|
303455737 2 9 |
correct output |
---|
58 |
user output |
---|
58 |
Test 9
Verdict: ACCEPTED
input |
---|
294702568 294702568 294702568 |
correct output |
---|
8546374472 |
user output |
---|
8546374472 |
Test 10
Verdict: ACCEPTED
input |
---|
726956430 3 861021531 |
correct output |
---|
90 |
user output |
---|
90 |
Test 11
Verdict: ACCEPTED
input |
---|
278722863 233665124 8 |
correct output |
---|
979718228 |
user output |
---|
979718228 |
Test 12
Verdict: ACCEPTED
input |
---|
468703136 101513930 801979803 |
correct output |
---|
2943903970 |
user output |
---|
2943903970 |
Test 13
Verdict: ACCEPTED
input |
---|
315634023 9 10 |
correct output |
---|
261 |
user output |
---|
261 |
Test 14
Verdict: ACCEPTED
input |
---|
125898168 125898168 125898168 |
correct output |
---|
3399250536 |
user output |
---|
3399250536 |
Test 15
Verdict: ACCEPTED
input |
---|
59961394 7 628175012 |
correct output |
---|
182 |
user output |
---|
182 |
Test 16
Verdict: ACCEPTED
input |
---|
656478043 131176230 4 |
correct output |
---|
688824428 |
user output |
---|
688824428 |
Test 17
Verdict: ACCEPTED
input |
---|
859484422 914544920 608413785 |
correct output |
---|
27130216465 |
user output |
---|
27130216465 |
Test 18
Verdict: ACCEPTED
input |
---|
756898538 9 5 |
correct output |
---|
262 |
user output |
---|
262 |
Test 19
Verdict: ACCEPTED
input |
---|
149798316 149798316 149798316 |
correct output |
---|
4194352848 |
user output |
---|
4194352848 |
Test 20
Verdict: ACCEPTED
input |
---|
38664371 4 184803527 |
correct output |
---|
104 |
user output |
---|
104 |
Test 21
Verdict: TIME LIMIT EXCEEDED
input |
---|
412776092 424268981 7 |
correct output |
---|
1570896123 |
user output |
---|
(empty) |
Test 22
Verdict: ACCEPTED
input |
---|
749241874 137806863 42999171 |
correct output |
---|
3935781156 |
user output |
---|
3935781156 |
Test 23
Verdict: ACCEPTED
input |
---|
982906997 2 6 |
correct output |
---|
60 |
user output |
---|
60 |
Test 24
Verdict: ACCEPTED
input |
---|
84420926 84420926 84420926 |
correct output |
---|
2279365002 |
user output |
---|
2279365002 |
Test 25
Verdict: ACCEPTED
input |
---|
937477085 8 572660337 |
correct output |
---|
240 |
user output |
---|
240 |
Test 26
Verdict: TIME LIMIT EXCEEDED
input |
---|
159126506 805750847 10 |
correct output |
---|
1591265060 |
user output |
---|
(empty) |
Test 27
Verdict: ACCEPTED
input |
---|
100661314 433925858 141616125 |
correct output |
---|
11122301217 |
user output |
---|
11122301217 |
Test 28
Verdict: ACCEPTED
input |
---|
84353896 3 6 |
correct output |
---|
81 |
user output |
---|
81 |
Test 29
Verdict: ACCEPTED
input |
---|
998898815 998898815 998898815 |
correct output |
---|
29966964450 |
user output |
---|
29966964450 |
Test 30
Verdict: ACCEPTED
input |
---|
548233368 5 585990365 |
correct output |
---|
150 |
user output |
---|
150 |