結果
| 問題 | No.11 カードマッチ |
| コンテスト | |
| ユーザー |
SagToki
|
| 提出日時 | 2018-06-04 10:02:38 |
| 言語 | Java (openjdk 23) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,737 bytes |
| 記録 | |
| コンパイル時間 | 3,897 ms |
| コンパイル使用メモリ | 80,648 KB |
| 実行使用メモリ | 55,248 KB |
| 最終ジャッジ日時 | 2024-06-30 09:32:46 |
| 合計ジャッジ時間 | 7,716 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 11 WA * 8 |
ソースコード
import java.util.Scanner;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.InputMismatchException;
public class CardMatch {
static Scanner scanner = new Scanner(System.in);
public static void main(String[] args){
int W = Input(1,1000000);
int H = Input(1,1000000);
int N = Input(1,Math.min(W*H,100));
ArrayList<Integer> S = new ArrayList<>();
ArrayList<Integer> K = new ArrayList<>();
for(int i = 0 ; i < N ; i++){
S.add(Input(1,W));
K.add(Input(1,H));
}
int Result = Processing(W,H,N,S,K);
System.out.println(Result);
}
public static int Input(int Min , int Max){
int Number = scanner.nextInt();
try{
if(Number < Min || Number > Max){
System.out.println(Min + "以上" + Max + "以下の数字で入力してください");
System.exit(0);
}
}catch(InputMismatchException e){
System.out.println("数字を入力してください");
System.exit(0);
}catch(Exception E){
System.out.println("想定外のエラーです");
System.exit(0);
}
return Number;
}
public static int Processing(int W , int H , int N
, ArrayList<Integer> S , ArrayList<Integer> K){
ArrayList<Integer> CountS = new ArrayList<>(new HashSet<>(S));
ArrayList<Integer> CountK = new ArrayList<>(new HashSet<>(K));
int Total = W * H ;
int UnmatchW = W - CountS.size();
int UnmatchH = H - CountK.size();
int Result = Total - UnmatchW * UnmatchH - N;
return Result;
}
}
SagToki