【打CF,学算法——一星级】Gym 100548A Built with Qinghuai and Ari Factor (Asia Xian)

原创 2015年07月08日 22:18:22

【CF简介】

提交链接:Built with Qinghuai and Ari Factor


题面:

Built with Qinghuai and Ari Factor
Description

DISCLAIMER: All names, incidents, characters and places appearing in this problem
are fictitious. Any resemblance to actual events or locales or real persons, living
or dead, is purely coincidental.
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 attoseconds1 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 official 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
.
11 attosecond equals to 10−18 seconds.
1The 2014 ACM-ICPC Asia Xi’an Regional Contest October 26, 2014
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).
Samples
Sample Input 

2
3
1 2 3
2
3000 996

Sample Output
Case #1: No
Case #2: Yes
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!


解题:

     签到题,题目神长,然而就两句话有用,就是全部数能整除3,输出yes,否则no。


代码:

#include <iostream>
using namespace std;
int main()
{
	int n,t,tmp;
	cin>>t;
	for(int i=1;i<=t;i++)
	{
		bool flag=true;
		cin>>n;
		for(int j=1;j<=n;j++)
		{
			cin>>tmp;
			if(tmp%3)
				flag=false;
		}
		cout<<"Case #"<<i<<": ";
		if(flag)cout<<"Yes\n";
		else cout<<"No\n";
	}
	return 0;
}



版权声明:欢迎交流!

相关文章推荐

文章标题 UVALive 7035: Built with Qinghuai and Ari Factor(水)

Built with Qinghuai and Ari FactorShamatisan is a somewhat famous smartphone maker in China, they bu...

Codeforces GYM 100548 F - Color 2014-2015 ACM-ICPC, Asia Xian Regional Contest

挣扎了好几天终于把这一题过了。。比赛的时候RP低到爆忘记带费马小定理和快速幂的模板,好不容易YY出了一个组合数的求法,然后发现公式推错了,最后呵呵呵呵。> 一开始的想法是C(m,k)k(k-1)^(n...
  • yixin94
  • yixin94
  • 2015年01月24日 19:46
  • 1044

【打CF,学算法——一星级】CodeForces 617D Polyline(水题)

题目链接:CF 617D 题面: A - Polyline Time Limit:1000MS     Memory Limit:262144KB     64bit IO Format:%...

【打CF,学算法——一星级】Codeforces 699A Launch of Collider (水题)

【CF简介】 题目链接:CF 699A 题面: A. Launch of Collider time limit per test 2 seconds ...

CF GYM 100548 The Problem to Make You Happy(2014ACM西安现场赛Problem H)

知识点: 有向图,博弈论,动态规划。 题目大意: Alice和Bob两人玩游戏。两人各有一个棋子,开始时在有向图中不同的点上。Bob先手,两人轮流移动棋子,每次只能将棋子移到相邻的点上(沿着图上的有向...
  • wujy47
  • wujy47
  • 2015年01月24日 14:49
  • 1748

CF GYM 100548 Color(2014ACM西安现场赛Problem F)

知识点: 组合数学-容斥原理,快速幂,逆元。 题目大意: 共有m 种颜色,为n盆排成一直线的花涂色。要求相邻花的颜色不相同,且使用的颜色恰好是k种。问一共有几种涂色方案(结果除10e9+7取余数)。 ...
  • wujy47
  • wujy47
  • 2015年01月24日 14:45
  • 2273

CF GYM 100548 International Collegiate Routing Contest(2014ACM西安现场赛Problem I)

解题思路: 每个IP地址由32位二进制组成。整个地址空间可以表现为一棵二叉树(简化的Trie树),如下图所示: 图中表示的是以下4个子网的覆盖情况: 0.0.0.0/1 (二进制前...
  • wujy47
  • wujy47
  • 2015年01月24日 14:42
  • 2432

【打CF,学算法——三星级】CodeForces 689B Mike and Shortcuts (最短路+spfa)

题目链接:CF 689B 题面: B. Mike and Shortcuts time limit per test 3 seconds memory limit per test ...

【打CF,学算法——二星级】CodeForces 282C XOR and OR (观察)

题目链接:CF 282C 题面: C. XOR and OR time limit per test 2 seconds memory limit per test 256 megabyt...

【打CF,学算法——四星级】CodeForces 514D R2D2 and Droid Army (RMQ+二分)

【CF简介】 提交链接:CF 514D 题面: D. R2D2 and Droid Army time limit per test 2 seconds ...
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:【打CF,学算法——一星级】Gym 100548A Built with Qinghuai and Ari Factor (Asia Xian)
举报原因:
原因补充:

(最多只允许输入30个字)