QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#298388 | #6249. بازی آرایه ای | mahdimalverdi | AC ✓ | 602ms | 64684kb | Java11 | 1001b | 2024-01-06 07:00:34 | 2024-01-06 07:00:34 |
Judging History
answer
import java.util.Scanner;
class Codechef {
public static void main(String[] args) throws java.lang.Exception {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int[] nums = new int[n];
for (int i = 0; i < n; i++) {
nums[i] = sc.nextInt();
}
long min = Integer.MAX_VALUE;
for (int i = 0; i < n; i++) {
long next = 0;
long counter = 0;
for (int j = i - 1; j > -1; j--) {
double x = Math.floor(1 + (double) next / nums[j]);
counter += x;
next = (long)(nums[j] * x);
}
next = 0;
for (int j = i + 1; j < n; j++) {
double x = Math.floor(1 + (double) next / nums[j]);
counter += x;
next = (long)(nums[j] * x);
}
min = Math.min(min, counter);
}
System.out.println(min);
}
}
详细
Test #1:
score: 100
Accepted
time: 90ms
memory: 55064kb
input:
5 1 2 3 4 5
output:
4
result:
ok single line: '4'
Test #2:
score: 0
Accepted
time: 74ms
memory: 58112kb
input:
7 1 2 1 2 1 2 1
output:
10
result:
ok single line: '10'
Test #3:
score: 0
Accepted
time: 156ms
memory: 55940kb
input:
550 43310 92728 63285 84642 85426 456 44542 25414 518 48178 27521 79082 83844 37228 27924 81995 4604 52414 36577 29595 98387 99557 88069 92771 98559 66802 1458 57020 72748 23273 2157 213 91226 59779 29136 73105 8444 70348 39113 90342 43386 28293 73081 57214 25520 40195 13207 72953 16365 90222 70987 ...
output:
231989
result:
ok single line: '231989'
Test #4:
score: 0
Accepted
time: 164ms
memory: 58796kb
input:
528 67962 73282 60059 33896 31499 72439 61234 59570 71996 8618 87265 11876 77573 99039 8545 19317 76355 50432 9330 50240 46165 82875 29748 39332 41471 61023 26318 14436 83018 42499 79723 85608 67362 61888 99544 7834 38519 24882 29224 30634 61500 94074 7536 91211 19307 54303 4747 63571 44832 11848 22...
output:
93118
result:
ok single line: '93118'
Test #5:
score: 0
Accepted
time: 600ms
memory: 60488kb
input:
4991 148978906 50920880 103853832 345078482 690024324 620786782 916521418 552479132 425442888 92911428 419915824 985437561 555804303 593333493 667471006 858107780 451236696 732125110 708015692 700663247 936308148 827214338 444446661 437655006 662034248 88265480 825864041 672079658 138660046 79335146...
output:
21074623
result:
ok single line: '21074623'
Test #6:
score: 0
Accepted
time: 550ms
memory: 59720kb
input:
5000 17495046 644701433 274707502 179203543 234503101 790750254 259705406 773413287 707747070 621947676 36251376 628270355 435406545 520336520 744918923 991612399 750708446 900523128 852312637 992951188 411231733 637289143 666321044 459968863 387120264 801359701 701256198 845537075 30959916 56087069...
output:
15691621
result:
ok single line: '15691621'
Test #7:
score: 0
Accepted
time: 564ms
memory: 61496kb
input:
4995 591043891 88738883 5369683 158552797 219173365 225554941 748113586 994347443 990051252 1240820 92778416 566070445 755200274 182498331 822366841 274860121 609988709 773953850 291576878 845047640 31379511 7172461 183162723 482282720 962463176 514453923 281681058 869251387 218227082 328389919 7086...
output:
16437683
result:
ok single line: '16437683'
Test #8:
score: 0
Accepted
time: 543ms
memory: 60200kb
input:
4993 19368543 682519437 30999161 992677858 763652142 100551116 796330278 920314302 567322731 675501259 559370863 358646343 634802515 109501358 45038950 558107843 204427755 942351868 290649630 992111389 946494585 522279970 550261299 209629281 832773384 522515440 712362815 747741507 110526953 24113333...
output:
16675059
result:
ok single line: '16675059'
Test #9:
score: 0
Accepted
time: 602ms
memory: 64684kb
input:
4991 592917387 421524182 761661342 972027112 308130919 830323100 434481562 141248458 554659617 349761699 615897903 1479138 954596244 626438977 122486867 986579758 63708017 815782590 729913871 139175137 126450875 742420183 67102978 231943138 557859401 235609661 587754972 771455820 2826823 8652564 502...
output:
12795371
result:
ok single line: '12795371'
Test #10:
score: 0
Accepted
time: 548ms
memory: 59968kb
input:
4993 493986372 897230808 84819238 676975705 234509367 920100063 69267923 766090988 105690157 443585170 593724493 96604947 671587676 68567499 168936991 168976718 208694977 418666701 458173140 665772989 330093977 320469433 74241151 253789351 451986409 52125978 776928308 585057015 70652664 457063002 60...
output:
16648617
result:
ok single line: '16648617'
Test #11:
score: 0
Accepted
time: 544ms
memory: 63432kb
input:
4991 56740 61598 53980 75429 59486 48848 18977 5438 29481 22304 20256 39151 14284 39456 1438 74165 64583 18806 58609 83201 62123 29918 61797 50583 55389 7142 62713 82416 40120 55121 62595 22520 14216 63349 59592 64336 15535 73788 72421 17133 54179 59207 47401 11735 31630 63462 20664 66635 25677 3059...
output:
17915760
result:
ok single line: '17915760'
Test #12:
score: 0
Accepted
time: 557ms
memory: 59988kb
input:
5000 72881 66343 16161 91978 62455 12319 2965 39593 959 15447 80000 39241 40718 9779 49355 78784 44845 49528 98657 46949 9901 37428 36180 64440 31005 1363 44470 72536 7286 74347 15969 32107 33456 98162 21488 31770 12906 93730 29827 57426 39590 57692 81855 69924 92714 10273 12204 33061 78336 76411 79...
output:
10892568
result:
ok single line: '10892568'
Test #13:
score: 0
Accepted
time: 542ms
memory: 59928kb
input:
5000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 100000000...
output:
6250000
result:
ok single line: '6250000'