Submission #800529
Source Code Expand
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.Arrays;
import java.util.ArrayList;
class Main{
public Main(){}
public void run(){
try{
Scanner s = new Scanner();
double a = s.nextLong();
double k = s.nextLong();
if((int)k==0){
System.out.println((long)(2*Math.pow(10,12)-a));
return;
}
double right = Math.ceil(Math.log10(2*Math.pow(10,12)+(1/k))-Math.log10(a+1/k))/Math.log10(k+1);
if(0<=right && right <1){
right = 1;
}
long n = (long)right;
System.out.println(n);
}catch(Exception e){
e.printStackTrace();
}
}
public static void main(String[] argv){
Main main = new Main();
main.run();
}
private class Scanner{
private int p;
private BufferedReader br;
String regex = " ";
String[] token;
public Scanner(){
br = new BufferedReader(new InputStreamReader(System.in));
p = -1;
token = new String[0];
}
void setRegex(String str){
this.regex = str;
}
void reset(){
p = -1;
token = new String[0];
}
String next() throws IOException{
if(p < 0){
String line = br.readLine();
while("".equals(line))line = br.readLine();
token = line.split(regex,0);
p = 0;
return token[p++];
}else{
if(p<token.length)return token[p++];
p = -1;
return null;
}
}
int nextInt() throws NumberFormatException, IOException{
return Integer.parseInt(next());
}
long nextLong() throws NumberFormatException, IOException{
return Long.parseLong(next());
}
double nextDouble() throws NumberFormatException, IOException{
return Double.parseDouble(next());
}
String nextString() throws NumberFormatException, IOException{
return next();
}
}
}
Submission Info
| Submission Time | |
|---|---|
| Task | A - 2兆円 |
| User | shopon1201 |
| Language | Java8 (OpenJDK 1.8.0) |
| Score | 0 |
| Code Size | 1869 Byte |
| Status | WA |
| Exec Time | 162 ms |
| Memory | 8148 KiB |
Judge Result
| Set Name | Sample | All | ||||||
|---|---|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 0 / 100 | ||||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | s1.txt, s2.txt, s3.txt |
| All | 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, s1.txt, s2.txt, s3.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| 01.txt | AC | 154 ms | 7888 KiB |
| 02.txt | AC | 154 ms | 8020 KiB |
| 03.txt | WA | 150 ms | 8020 KiB |
| 04.txt | AC | 154 ms | 7892 KiB |
| 05.txt | AC | 154 ms | 7892 KiB |
| 06.txt | AC | 154 ms | 7892 KiB |
| 07.txt | AC | 158 ms | 8148 KiB |
| 08.txt | WA | 154 ms | 7888 KiB |
| 09.txt | WA | 154 ms | 8016 KiB |
| 10.txt | AC | 162 ms | 7892 KiB |
| 11.txt | WA | 154 ms | 7892 KiB |
| 12.txt | WA | 162 ms | 7892 KiB |
| 13.txt | AC | 150 ms | 7892 KiB |
| s1.txt | AC | 158 ms | 7892 KiB |
| s2.txt | AC | 158 ms | 7892 KiB |
| s3.txt | AC | 158 ms | 8020 KiB |