結果
| 問題 |
No.1686 Geschenkt
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-11-22 07:04:30 |
| 言語 | JavaScript (node v23.5.0) |
| 結果 |
AC
|
| 実行時間 | 63 ms / 2,000 ms |
| コード長 | 421 bytes |
| コンパイル時間 | 281 ms |
| コンパイル使用メモリ | 7,200 KB |
| 実行使用メモリ | 38,912 KB |
| 最終ジャッジ日時 | 2024-09-22 17:16:52 |
| 合計ジャッジ時間 | 3,231 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 7 |
ソースコード
function arrInt(arr) {
return arr.map(str => parseInt(str, 10))
.sort((a, b) => a - b);
}
function Main(input) {
const src = input.split("\n");
const n = parseInt(src[0]);
const a = arrInt(src[1].split(" "));
let ans = a[0];
for (let i = 1; i < n; i++) {
if (a[i - 1] != (a[i] - 1)) ans += a[i];
}
console.log(ans);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));