南邮 OJ 1128 An Industrial Spy
An Industrial Spy
時間限制(普通/Java)?:? 10000 MS/?30000 MS?? ? ? ???運行內(nèi)存限制 : 65536 KByte總提交 : 38 ? ? ? ?? ? 測試通過 : 20?
比賽描述
Industrial spying is very common for modern research labs. I am such an industrial spy { don't tell?anybody! My recent job was to steal the latest inventions from a famous math research lab. It was?hard to obtain some of their results but I got their waste out of a document shredder.
I have already reconstructed that their research topic is fast factorization. But the remaining paper?snippets only have single digits on it and I cannot imagine what they are for. Could it be that those?digits form prime numbers? Please help me to nd out how many prime numbers can be formed?using the given digits.
輸入
The rst line of the input holds the number of test cases c (1 <= c <= 200). Each test case consists of a?single line. This line contains the digits (at least one, at most seven) that are on the paper snippets.
輸出
For each test case, print one line containing the number of di erent primes that can be reconstructed?by shuing the digits. You may ignore digits while reconstructing the primes (e.g., if you get?the digits 7 and 1, you can reconstruct three primes 7, 17, and 71). Reconstructed numbers that?(regarded as strings) di er just by leading zeros, are considered identical (see the fourth case of the?sample input).
樣例輸入
4
17
1276543
9999999
011
樣例輸出
3
1336
0
2
題目來源
NWERC2009
總結
以上是生活随笔為你收集整理的南邮 OJ 1128 An Industrial Spy的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 推荐系统之用户标签,以及基于标签的算法
- 下一篇: PDF时间戳数字签名