結果
問題 | No.11 カードマッチ |
ユーザー | aaaaasatori |
提出日時 | 2018-02-18 15:09:16 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 178 ms / 5,000 ms |
コード長 | 670 bytes |
コンパイル時間 | 3,467 ms |
コンパイル使用メモリ | 75,816 KB |
実行使用メモリ | 54,764 KB |
最終ジャッジ日時 | 2024-06-24 12:45:22 |
合計ジャッジ時間 | 7,524 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 19 |
ソースコード
import java.util.ArrayList;import java.util.List;import java.util.Scanner;public class No11 {public static void main(String[] args) {Scanner sc = new Scanner(System.in);long W = sc.nextLong(); //マークの種類long H = sc.nextLong(); //数字の最大値long N = sc.nextLong(); //持ってるカードの枚数List<Integer> S = new ArrayList<Integer>();List<Integer> K = new ArrayList<Integer>();for(int i = 0;i < N;i++) {int s = sc.nextInt();int k = sc.nextInt();if(S.indexOf(s) == -1) {S.add(s);}if(K.indexOf(k) == -1) {K.add(k);}}System.out.println(W*H - ((W-S.size())*(H-K.size())) - N);}}