結果
| 問題 |
No.2835 Take and Flip
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-03-11 22:58:58 |
| 言語 | JavaScript (node v23.5.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 343 bytes |
| コンパイル時間 | 458 ms |
| コンパイル使用メモリ | 7,320 KB |
| 実行使用メモリ | 75,680 KB |
| 最終ジャッジ日時 | 2025-03-11 22:59:08 |
| 合計ジャッジ時間 | 8,850 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 2 |
| other | AC * 2 WA * 20 |
ソースコード
function Main(INPUT){
const input=INPUT.split("\n");
const N=parseInt(input[0]);
const A=input[1].split(" ").map(_=>parseInt(_)).sort((a,b)=>b-a);
let ans=0;
for(let i=0;i<N;i++){
if(i%2==0){
ans+=A[i];
}
else{
ans-=A[i];
}
}
console.log(ans);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));