CF GYM 100548 Built with Qinghuai and Ari Factor(2014ACM西安现场赛Problem A)
来源:互联网 发布:淘宝网企业开店费用 编辑:程序博客网 时间:2024/06/06 14:10
ProblemA. Built with Qinghuai and Ari Factor
Description
DISCLAIMER: Allnames, incidents, characters and places appearing in this problem arefictitious. Any resemblance to actual events or locales or realpersons, living or dead, is purely coincidental.
Shamatisan is asomewhat famous smartphone maker in China, they built smartphonesthat hope to contend with Abble and Dami for the hearts, minds andthe wallets of China’s consumers. They have a famous advertisingword, saying that Shamatisan phones are built with Qinghuai (aconcept which is hard to explain in English). Their latest phone T-1has just began taking reservations recently, or to be precious, atthe beginning of this month. But those who are tracking its progresson Aripapapa’s online store Skyat noticed an interesting fact thathas led to an apology by the online shopping site.
Those (being likesleuths in this story) who are always curious about questions like“In how many attoseconds1 were the Dami phones sold out?” foundsomething unusual about the reservation count of Shamatisan T-1. Italways has a divisor three! What’s the logic behind this mystery? Abit of digging into the site coding showed that the number ofreservations had been multipled by three. After this discovery,people started rumors like “Three is the Qinghuai factor, appliedbroadly by Shamatisan internally.” and began to call integers,which are divisible by three, Qinghuai numbers. They also defined ifall elements in a sequence are Qinghuai numbers, the sequence itselfis said to be built with Qinghuai. Moreover, after some research,people found that there is a feature called “Buy Buy Buy Ring” onSkyat, causing all reservation counts multiplied by a factor(possibly 1). The rumor “Any real number can be represented as anAripapapa Factor (also known as Ari Factor)” had been spreadwidely.
Later, anAripapapa’s spokeswoman said this was an incident and posted anofficial apology announcement. It is said that a programmer “made ahighly unscientific decision”. As a result, main programmer ofSkyat whose name is Beiguoxia lost his job.
Our protagonistPike loves to write programs that are able to automatically grab somedata from Internet. As you may already know, such programs areusually called “spider”.
Pike has alreadycollected some sequence using his spider. Now he wonders that ifthese sequences are built with Qinghuai. Help Pike to figure outthis!
Input
The first line ofthe 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 ofsequence S. The second line contains n integers, which represent nintegers in sequence S.
All the numbers inthe input will not exceed 106. 11 attosecond equals to 10−18seconds.
Output
For each test caseoutput one line “Case #x: y”, where x is the case number(starting from 1) and y is “Yes” (without quotes) if the sequenceS is built with so-called “Qinghuai”, otherwise “No” (withoutquotes).
Samples
Sample Input
Sample Output
2
3
1 2 3
2
3000 996
Case #1: No
Case #2: Yes
Hints
In the first case,since the sequence contains numbers which are too small to haveQinghuai, it cannot be called being built with Qinghuai.
In the second case,the first integer is the signage of Shamatisan, and the secondinteger represents core values of Aripapapa, we can declare that thesequence is built with Qinghuai.
Also note that thewhole problem statement (including hints) had deliberately beenwritten as a joke, don’t be so serious!
知识点:
水题。
解题思路:
当输入的n个数都能被3整除时,输出“Yes”;否则输出“No”。
参考代码:
#include <iostream>#include <cstdio>using namespace std;int cCase, nCase, n, x;int main() { scanf("%d", &nCase); while (nCase--) { scanf("%d", &n); bool flag = true; for (int i = 0; i < n; i++) { scanf("%d", &x); if (x % 3 != 0) { flag = false; } } if (flag) { printf("Case #%d: Yes\n", ++cCase); } else { printf("Case #%d: No\n", ++cCase); } } return 0;}
- CF GYM 100548 Built with Qinghuai and Ari Factor(2014ACM西安现场赛Problem A)
- 【打CF,学算法——一星级】Gym 100548A Built with Qinghuai and Ari Factor (Asia Xian)
- UVALive 7035 Built with Qinghuai and Ari Factor(水题)
- 文章标题 UVALive 7035: Built with Qinghuai and Ari Factor(水)
- CF GYM 100548 Last Defence(2014ACM西安现场赛Problem K)
- CF GYM 100548 International Collegiate Routing Contest(2014ACM西安现场赛Problem I)
- CF GYM 100548 Color(2014ACM西安现场赛Problem F)
- CF GYM 100548 Color(2014ACM西安现场赛Problem F)
- CF GYM 100548 The Problem Needs 3D Arrays(2014ACM西安现场赛Problem C)
- CF GYM 100548 The Problem to Make You Happy(2014ACM西安现场赛Problem H)
- CF GYM 100548 International Collegiate Routing Contest(2014ACM西安现场赛Problem I)不懂提
- 【2014acm西安现场赛】A
- gym 100548题解(2014年西安现场赛(回文树,01字典树,容斥))
- 【2014acm西安现场赛】K
- 【2014acm西安现场赛】F
- Codeforces Gym 100548G The Problem to Slow Down You (Palindromic Tree 或 Hash水过) 2014西安现场赛G题
- Codeforces gym 100548 F (2014-2015 icpc西安现场赛) 数学
- uvalive7040 / cf gym 100548 Color(2014 ICPC 西安 F)
- HEVC中的Z order 和Raster order
- 日经社説 20150124 ECB量的緩和が政府に迫る構造改革
- Launcher2 自定义应用快捷方式图标
- 我所理解的设计模式(C++实现)—— “一句话总结”和索引
- XMPP roster 离线加好友会导致UI卡住的解决方法
- CF GYM 100548 Built with Qinghuai and Ari Factor(2014ACM西安现场赛Problem A)
- python多线程运维脚本
- 我所理解的设计模式(C++实现)——访问者模式(Visitor Pattern)
- 社説 20150124 白鵬33度目優勝 大相撲史に名を刻む偉業だ
- codebook码本算法
- iOS WebP图片格式
- 我所理解的设计模式(C++实现)——策略模式(Strategy Pattern)
- 社説 20150124 邦人人質事件 解放へあらゆる手段を尽くせ
- 我所理解的设计模式(C++实现)——状态模式(State Pattern)