結果
問題 | No.99 ジャンピング駒 |
ユーザー |
![]() |
提出日時 | 2018-05-16 20:27:56 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 683 ms / 5,000 ms |
コード長 | 455 bytes |
コンパイル時間 | 2,073 ms |
コンパイル使用メモリ | 74,248 KB |
実行使用メモリ | 48,316 KB |
最終ジャッジ日時 | 2024-06-28 13:20:47 |
合計ジャッジ時間 | 7,328 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 6 |
ソースコード
import java.util.Scanner;public class Main {public static void main(String[] args) {Scanner scan = new Scanner(System.in);int N = scan.nextInt();int cnt1 = 0;int cnt2 = 0;for(int i = 0; i < N; i++) {long x = scan.nextLong();if(x % 2 == 0) {cnt1 ++;}else {cnt2 ++;}}scan.close();int ans = 0;if(cnt1 >= cnt2) {ans = cnt1 - cnt2;}else {ans = cnt2 - cnt1;}System.out.println(ans);}}