码迷,mamicode.com
首页 > 其他好文 > 详细

CF GYM 100548 Built with Qinghuai and Ari Factor(2014ACM西安现场赛Problem A)

时间:2015-01-24 15:59:25      阅读:126      评论:0      收藏:0      [点我收藏+]

标签:acm2014   acm-icpc   西安2014   

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)

标签:acm2014   acm-icpc   西安2014   

原文地址:http://blog.csdn.net/wujysh/article/details/43085185

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!