結果
| 問題 | No.910 素数部分列 |
| コンテスト | |
| ユーザー |
ks2m
|
| 提出日時 | 2019-10-18 21:42:27 |
| 言語 | Java (openjdk 25.0.2) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 659 bytes |
| 記録 | |
| コンパイル時間 | 2,264 ms |
| コンパイル使用メモリ | 81,592 KB |
| 実行使用メモリ | 46,596 KB |
| 最終ジャッジ日時 | 2026-03-12 00:16:24 |
| 合計ジャッジ時間 | 6,294 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 8 WA * 42 |
ソースコード
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class Main {
public static void main(String[] args) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(br.readLine());
String s = br.readLine();
br.close();
int[] cnt = new int[10];
for (int i = 0; i < n; i++) {
cnt[s.charAt(i) - '0']++;
}
int ans = 0;
ans += cnt[3];
ans += cnt[5];
ans += cnt[7];
ans += cnt[1] / 2;
if (cnt[1] % 2 == 1) {
int a = s.indexOf("1");
int b = s.lastIndexOf("9");
if (a != -1 && b != -1 && a < b) {
ans++;
}
}
System.out.println(ans);
}
}
ks2m