QOJ.ac

QOJ

时间限制: 2 s 内存限制: 256 MB 总分: 100

#15370. Maximum Non-Prime Related Subset Problem

统计

For two given positive integers $x$ and $y$, if there exists a prime number $p$ such that $x \cdot p = y$, then the positive integers $x$ and $y$ are said to be prime-related.

For a given set $S$ consisting of $n$ positive integers, if $S_1$ is a subset of $S$ such that no two positive integers in $S_1$ are prime-related, then $S_1$ is called a non-prime-related subset of $S$. The maximum non-prime-related subset of $S$ is the non-prime-related subset with the largest number of elements.

The maximum non-prime-related subset problem asks to find the size of the maximum non-prime-related subset for a given set $S$ of $n$ positive integers.

Input

The first line contains a positive integer $T$, representing the number of test cases.

Each test case consists of two lines: The first line contains a positive integer $n$, representing the number of positive integers in set $S$. The second line contains $n$ positive integers, which are the elements of set $S$.

Output

For each test case, output a single line in the format "Case #T: ans", where $T$ is the test case number (starting from 1) and $ans$ is the answer.

Constraints

Data Point $T$ $n$ Number Size Note
1 10 $\le 15$ $\le 10000$
2 $\le 50000000$
3 $\le 40$
4 $\le 100$ $\le 10000$ Randomly generated
5
6 20 $\le 5000$ $\le 10000$ Randomly generated
7 $\le 50000000$
8 $\le 5000$
9 50 $\le 3000$ $\le 10000$
10 $\le 50000000$

Examples

Input 1

3
5
2 4 6 8 10
5
2 3 5 7 11
9
2 3 4 5 6 7 8 9 10

Output 1

Case #1: 3
Case #2: 5
Case #3: 5

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.