Submission #44925


ソースコード

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import java.util.*;
import java.util.function.*;
class Main{
static Scanner s=new Scanner(System.in);
public static void main(String[] $){
int a=s.nextInt();
int b=s.nextInt();
long t=s.nextLong();
System.out.println(binSearch(0L,t,i->{
long q=(long)Math.sqrt(i);
long r=q*a+(i-q)*b;
return r>=t;
}));
}
static long binSearch(long f,long t,Predicate<Long> p){
while(t-f>1){
if(p.test((t+f)/2))
t=(t+f)/2;
else
f=(t+f)/2;
}
return t;
}
}

ステータス

項目 データ
問題 0993 - 貯金 (Saving Money)
ユーザー名 fal_rnd
投稿日時 2018-11-14 23:45:39
言語 Java
状態 Accepted
得点 10
ソースコード長 515 Byte
最大実行時間 215 ms
最大メモリ使用量 17140 KB

セット

セット 得点 Cases
1 ALL 10 / 10 *

テストケース

ファイル名 状態 実行時間 メモリ使用量 #
input-sample01 AC 144 ms 15456 KB
1
input-sample02 AC 126 ms 15392 KB
1
input-sample03 AC 133 ms 15428 KB
1
input01 AC 124 ms 15552 KB
1
input02 AC 215 ms 15704 KB
1
input03 AC 129 ms 15672 KB
1
input04 AC 121 ms 15656 KB
1
input05 AC 125 ms 15488 KB
1
input06 AC 121 ms 15532 KB
1
input07 AC 122 ms 15688 KB
1
input08 AC 134 ms 16784 KB
1
input09 AC 135 ms 15096 KB
1
input10 AC 127 ms 15648 KB
1
input11 AC 122 ms 15708 KB
1
input12 AC 131 ms 15820 KB
1
input13 AC 129 ms 15760 KB
1
input14 AC 124 ms 15300 KB
1
input15 AC 123 ms 15212 KB
1
input16 AC 143 ms 15380 KB
1
input17 AC 124 ms 17140 KB
1
input18 AC 135 ms 15556 KB
1
input19 AC 131 ms 15680 KB
1
input20 AC 126 ms 15656 KB
1
input21 AC 119 ms 15224 KB
1
input22 AC 125 ms 15536 KB
1
input23 AC 126 ms 15600 KB
1
input24 AC 128 ms 15472 KB
1
input25 AC 127 ms 15456 KB
1
input26 AC 124 ms 15708 KB
1
input27 AC 122 ms 15528 KB
1
input28 AC 128 ms 15656 KB
1
input29 AC 123 ms 15664 KB
1
input30 AC 138 ms 15700 KB
1