結果
| 問題 |
No.480 合計
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-01-10 17:09:03 |
| 言語 | JavaScript (node v23.5.0) |
| 結果 |
AC
|
| 実行時間 | 68 ms / 2,000 ms |
| コード長 | 767 bytes |
| コンパイル時間 | 229 ms |
| コンパイル使用メモリ | 7,072 KB |
| 実行使用メモリ | 41,716 KB |
| 最終ジャッジ日時 | 2024-11-14 10:57:39 |
| 合計ジャッジ時間 | 2,610 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 22 |
ソースコード
const lineIter = (function* () {
const stdin = require('fs').readFileSync(process.stdin.fd, 'utf8');
const lines = stdin.trim().split('\n');
for (const line of lines) {
yield line.trim();
}
})();
const wordIter = (function* () {
while (true) {
const { done, value: line } = lineIter.next();
if (done) {
break;
}
const words = line.split(' ');
for (const word of words) {
yield word;
}
}
})();
const read = () => wordIter.next().value;
const main = async () => {
const n = parseInt(read());
const sum = Array(n)
.fill()
.map((_, i) => i + 1)
.reduce((acc, num) => acc + num, 0);
console.log(`${sum}`);
};
(async () => {
try {
await main();
} catch (e) {
console.error(e);
}
})();