文章标题 UVALive 7035: Built with Qinghuai and Ari Factor(水)
来源:互联网 发布:mysql数据库存储过程 编辑:程序博客网 时间:2024/06/16 02:12
Built with Qinghuai and Ari Factor
Shamatisan is a somewhat famous smartphone maker in China, they built smartphones that hope to contend with Abble and Dami for the hearts, minds and the wallets of China’s consumers. They have a famous advertising word, saying that Shamatisan phones are built with Qinghuai (a concept which is hard to explain in English). Their latest phone T−1 has just began taking reservations recently, or to be precious, at the beginning of this month. But those who are tracking its progress on Aripapapa’s online store Skyat noticed an interesting fact that has led to an apology by the online shopping site. Those (being like sleuths in this story) who are always curious about questions like “In how many attoseconds (1 attosecond equals to 10−18 seconds) were the Dami phones sold out?” found something unusual about the reservation count of Shamatisan T−1. It always has a divisor three! What’s the logic behind this mystery? A bit of digging into the site coding showed that the number of reservations had been multipled by three. After this discovery, people started rumors like “Three is the Qinghuai factor, applied broadly by Shamatisan internally.” and began to call integers, which are divisible by three, Qinghuai numbers. They also defined if all elements in a sequence are Qinghuai numbers, the sequence itself is said to be built with Qinghuai. Moreover, after some research, people found that there is a feature called “Buy Buy Buy Ring” on Skyat, causing all reservation counts multiplied by a factor (possibly 1). The rumor “Any real number can be represented as an Aripapapa Factor (also known as Ari Factor)” had been spread widely. Later, an Aripapapa’s spokeswoman said this was an incident and posted an ocial apology announcement. It is said that a programmer “made a highly unscientific decision”. As a result, main programmer of Skyat whose name is Beiguoxia lost his job. Our protagonist Pike loves to write programs that are able to automatically grab some data from Internet. As you may already know, such programs are usually called “spider”. Pike has already collected some sequence using his spider. Now he wonders that if these sequences are built with Qinghuai. Help Pike to figure out this!
Input
The first line of the input gives the number of test cases, T. T test cases follow. For each test case, the first line contains an integer n (1 ≤ n ≤ 100), the length of sequence S. The second line contains n integers, which represent n integers in sequence S. All the numbers in the input will not exceed 106.
Output
For each test case output one line ‘Case #x: y’, where x is the case number (starting from 1) and y is ‘Yes’ (without quotes) if the sequence S is built with so-called “Qinghuai”, otherwise ‘No’ (without quotes).
Hints: In the first case, since the sequence contains numbers which are too small to have Qinghuai, it cannot be called being built with Qinghuai. In the second case, the first integer is the signage of Shamatisan, and the second integer represents core values of Aripapapa, we can declare that the sequence is built with Qinghuai. Also note that the whole problem statement (including hints) had deliberately been written as a joke, don’t be so serious!
Sample Input
2
3
1 2 3
2
3000 996
Sample Output
Case #1: No
Case #2: Yes
题意:题目好长好长好长,但其实只要理解其中的两三句话,就能解了,其实就是给你一个数组,判断这个数组里的数是不是能整除3,如果都可以的话,就输出T,有不能整除3的话就输出F。
代码:
#include<iostream>#include<string>#include<cstdio>#include<cstring>#include<vector>#include<math.h>#include<map>#include<set>#include<queue> #include<algorithm>using namespace std;const int inf = 0x3f3f3f3f;int n;bool judge;int main(){ int total; scanf("%d", &total); for(int i=1; i<=total; i++) { judge = true; scanf("%d", &n); int a; for(int j=0; j<n; j++) { scanf("%d", &a); if(a%3 != 0) judge = false; } if(judge) printf("Case #%d: Yes\n", i); else printf("Case #%d: No\n", i); } return 0;}
- 文章标题 UVALive 7035: Built with Qinghuai and Ari Factor(水)
- UVALive 7035 Built with Qinghuai and Ari Factor(水题)
- CF GYM 100548 Built with Qinghuai and Ari Factor(2014ACM西安现场赛Problem A)
- 【打CF,学算法——一星级】Gym 100548A Built with Qinghuai and Ari Factor (Asia Xian)
- 文章标题 UVALive 6432 Influence(dfs)
- 文章标题UVALive 6424:Russian Dolls(贪心)
- 文章标题 UVALive 7740 : Coding Contest (费用流+精度)
- 文章标题 CoderForces 755A : PolandBall and Hypothesis(水)
- 文章标题 Coderforces 755B : PolandBall and Game(水)
- 文章标题 UVALive 7045:Last Defence(辗转相除思想)
- 文章标题 UVALive 4670 : Dominating Patterns (AC自动机模板题)
- 文章标题 UVALive 6062:Reduce the Maintenance Cost(双联通分量缩点)
- Debug a built binary file with VS and *.pdb file
- 文章标题HDU 4355:codeforces 621C:Wet Shark and Flowers(水)
- 文章标题 HDU 5113 : Black And White (dfs+剪枝)
- 文章标题 Coderforces 689B : Mike and Shortcuts (BFS)
- 文章标题 coderforces 761B : Dasha and friends(KMP)
- 文章标题 CRB and His Birthday
- LeetCode 395 Longest Substring with At Least K Repeating Characters
- IOS Present View Controller 详解
- 非标自动化设备开发流程
- 薪金问题中的四舍五入算法的实现
- leetcode之389. Find the Difference(C++解法)
- 文章标题 UVALive 7035: Built with Qinghuai and Ari Factor(水)
- CodeForces 236 B. Easy Number Challenge
- hdu5875 Function(暴力)
- 设计模式(2)-抽象工厂模式(Abstract Factory)
- 深入理解Java的接口和抽象类
- 国产数据库增量备份测试-神州通用数据库
- android底部导航栏的程序代码
- 几何算法专题2
- Sql Server 2008-闲聊