Jayden is a little kid who likes to watch videos on YouTube. However, the internet connection is slow, and the video will stop playing at certain times to "buffer", or load more of the video.
The video has a length of seconds. Let be the amount of seconds it takes Jayden's internet connection to download one second of the video. Jayden wants to watch the video uninterrupted, so he decides to wait seconds to let the video buffer before playing it.
Since Jayden is impatient, he wants to start watching at the earliest time possible that allows the video to play through without interruption. Help him find the smallest amount of time !
Input Specification
On a single line will be the two integers (YouTube videos are usually limited to fifteen minutes in length) and .
Output Specification
On a single line, output the integer .
Sample Input 1
5 3
Sample Output 1
10
Sample Input 2
1 3
Sample Output 2
2
Comments
my program is correct !!! but i get a wg
Your math is wrong, I have tested and compiled it in Java and I also got WA.
The formula in your code only works for the two test cases above, but not for the test cases when you submit your solution.
For some reason when I enter the sample input into my code the answer appears one line below where it should appear. So like this:
Is there any way to output my answer directly below the input so there is no gap? I am just using a
System.out.print();
to output my answers. I think the gap is why I keep getting invalid return when I try to submit my code.I've been at this problem for 3 hours now.
For some reason when I press the "Copy" button in the top right corners of the sample outputs and I enter it into the console, it skips a line. For example,
Do you see the gap between the "5 3" and the "10"?
when I enter it in manually there is no gap.
This is causing me a lot of problems since the online judge is trying to read the space in between the "5 3" and the "10" resulting in a "java.util.NoSuchElementException".
At least I think this is what is going on. Does anybody know how I can solve this issue? It seems I am the first to encounter this so it is probably a problem on my end.
The judge doesn't read the input, only the output. The "java.util.NoSuchElementException" exception is on your side. If you're using Scanner, are you using both .nextLine() and .nextInt()? If you're still having trouble, try using BufferedReader -- I had no problem with it.
I used the above format in order to get to the input into Integer form but I keep getting this error when trying to parse the string into an integer form:
Exception in thread "main" java.lang.NumberFormatException: For input string: ""
Strange... I get AC when using your input.
Perhaps instead of using .split(), use StringTokenizer. If there are two spaces between 5 and 3 (I.E. "5 3"), it would yield a NumberFormatException.
I tried using the StringTokenizer but I am still back at the same problem "nullpointerexception".
When I manually type in the numbers the output appears like so:
But when I copy the numbers the output appears like this:
I have no idea what the problem is. Also I am using StringTokenizer like so (may or may not be right):
Why are you using a loop to read a single line input?