提出 #73092457
ソースコード 拡げる
function Main(input) {
input=input.split("\n");
// input=input[0];
const NMK=input[0].split(" ");
var N=parseInt(NMK[0],10);
// var K=parseInt(NMK[1],10);
// var N=parseInt(NMK[2],10);
// var N=NMK[0];
// var S=NMK[0];
// var T=NMK[1];
// var sum=0;
const Aa=input[1].split(" ");
// const S=[];
// var result=[];
// var sum=0;
// var sum2=0;
// var maxa=Math.max(...Aa);
//累積和
// const rui=[];
// rui[0]=0;
// for(var i=1;i<=N;i++){
// rui[i]=rui[i-1]+parseInt(Aa[i-1]);
// }
// var max1=0;
// var max2=0;
// for(var i=0;i<N;i++){
// S[i]=0;
// }
sum=0n;
const A=[];
Na=BigInt(N);
for(var i=0;i<N;i++){
A[i]=parseInt(Aa[i]);
}
// A.sort((a, b) => a - b);
// console.log(A);
// var max=0;
// for(var i=1;i<N+1;i++){
// if(max<A[i]){
// // sum+=(Na-BigInt(i))*10n**(BigInt(A[i])-1n);
// sum+=(Na-BigInt(i))*((10n**BigInt(A[i])-1n)/9n)-(Na-BigInt(i))*((10n**BigInt(A[i-1])-1n)/9n);
// max=A[i];
// }
// }
for(var i=0;i<N;i++){
sum+=((10n**BigInt(A[i]))-1n)/9n;
}
console.log(sum.toString());
}
// Main(`3
// 30 10 20
// `)
Main(require("fs").readFileSync("/dev/stdin", "utf8")); // これは必ず必要な呪文です
提出情報
| 提出日時 | |
|---|---|
| 問題 | D - Many Repunit Sum |
| ユーザ | seitakaa3511 |
| 言語 | JavaScript (Node.js 22.19.0) |
| 得点 | 0 |
| コード長 | 1285 Byte |
| 結果 | TLE |
| 実行時間 | > 2000 ms |
| メモリ | 63328 KiB |
ジャッジ結果
| セット名 | Sample | All | ||||||
|---|---|---|---|---|---|---|---|---|
| 得点 / 配点 | 0 / 0 | 0 / 400 | ||||||
| 結果 |
|
|
| セット名 | テストケース |
|---|---|
| Sample | 0_sample_1.txt, 0_sample_2.txt, 0_sample_3.txt |
| All | 0_sample_1.txt, 0_sample_2.txt, 0_sample_3.txt, 1_01.txt, 1_02.txt, 1_03.txt, 1_04.txt, 1_05.txt, 1_06.txt, 1_07.txt, 1_08.txt, 1_09.txt, 1_10.txt, 1_11.txt, 1_12.txt, 1_13.txt, 1_14.txt, 1_15.txt, 1_16.txt, 1_17.txt, 1_18.txt, 1_19.txt, 1_20.txt, 2_1.txt, 2_2.txt, 2_3.txt, 2_4.txt, 2_5.txt, 2_6.txt, 2_7.txt |
| ケース名 | 結果 | 実行時間 | メモリ |
|---|---|---|---|
| 0_sample_1.txt | AC | 31 ms | 40812 KiB |
| 0_sample_2.txt | AC | 26 ms | 40740 KiB |
| 0_sample_3.txt | AC | 26 ms | 40944 KiB |
| 1_01.txt | TLE | > 2000 ms | 54152 KiB |
| 1_02.txt | TLE | > 2000 ms | 53952 KiB |
| 1_03.txt | TLE | > 2000 ms | 54128 KiB |
| 1_04.txt | TLE | > 2000 ms | 53900 KiB |
| 1_05.txt | TLE | > 2000 ms | 53960 KiB |
| 1_06.txt | TLE | > 2000 ms | 54132 KiB |
| 1_07.txt | TLE | > 2000 ms | 54116 KiB |
| 1_08.txt | TLE | > 2000 ms | 54104 KiB |
| 1_09.txt | TLE | > 2000 ms | 54116 KiB |
| 1_10.txt | TLE | > 2000 ms | 54064 KiB |
| 1_11.txt | TLE | > 2000 ms | 54128 KiB |
| 1_12.txt | TLE | > 2000 ms | 54212 KiB |
| 1_13.txt | TLE | > 2000 ms | 54124 KiB |
| 1_14.txt | TLE | > 2000 ms | 54144 KiB |
| 1_15.txt | TLE | > 2000 ms | 54172 KiB |
| 1_16.txt | TLE | > 2000 ms | 54208 KiB |
| 1_17.txt | TLE | > 2000 ms | 53964 KiB |
| 1_18.txt | TLE | > 2000 ms | 54172 KiB |
| 1_19.txt | TLE | > 2000 ms | 54292 KiB |
| 1_20.txt | TLE | > 2000 ms | 54020 KiB |
| 2_1.txt | AC | 53 ms | 63248 KiB |
| 2_2.txt | AC | 57 ms | 63328 KiB |
| 2_3.txt | TLE | > 2000 ms | 52792 KiB |
| 2_4.txt | TLE | > 2000 ms | 37396 KiB |
| 2_5.txt | AC | 25 ms | 41092 KiB |
| 2_6.txt | AC | 70 ms | 41864 KiB |
| 2_7.txt | AC | 47 ms | 41664 KiB |