結果
| 問題 |
No.587 七対子
|
| コンテスト | |
| ユーザー |
fukusei
|
| 提出日時 | 2018-05-05 17:59:10 |
| 言語 | Java (openjdk 23) |
| 結果 |
AC
|
| 実行時間 | 158 ms / 2,000 ms |
| コード長 | 663 bytes |
| コンパイル時間 | 3,120 ms |
| コンパイル使用メモリ | 81,276 KB |
| 実行使用メモリ | 42,556 KB |
| 最終ジャッジ日時 | 2024-07-19 19:53:30 |
| 合計ジャッジ時間 | 9,055 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 35 |
ソースコード
import java.util.*;
public class paiza {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String str = sc.nextLine();
int count = 0;
String match = "";
char ch;
for (int i = 0; i < str.length(); i++) {
ch = str.charAt(i);
if ( str.indexOf(ch,i+1) != -1) {
if ( match.indexOf(ch) == -1 ){
count++;
match = match + ch;
}
}
}
if (count == 6) {
for(int i=0; i<str.length(); i++) {
if(match.indexOf(str.charAt(i)) == -1){
System.out.println(str.charAt(i));
return;
}
}
System.out.println("Impossible");
}
else {
System.out.println("Impossible");
}
}
}
fukusei