ZOJ 3959 Problem Preparation 【水】
题目链接
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3959
AC代码
#include <cstdio>
#include <cstring>
#include <ctype.h>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <deque>
#include <vector>
#include <queue>
#include <string>
#include <map>
#include <stack>
#include <set>
#include <numeric>
#include <sstream>
using namespace std;
typedef long long LL;
const double PI = 3.14159265358979323846264338327;
const double E = 2.718281828459;
const double eps = 1e-6;
const int MAXN = 0x3f3f3f3f;
const int MINN = 0xc0c0c0c0;
const int maxn = 1e2 + 5;
const int MOD = 1e9 + 7;
int arr[maxn];
int main()
{
int t;
scanf("%d", &t);
a:
while (t--)
{
int n;
memset(arr, 0, sizeof(arr));
scanf("%d", &n);
for (int i = 0; i < n; i++)
scanf("%d", &arr[i]);
sort(arr, arr + n);
if (n < 10 || n > 13)
{
cout << "No\n";
goto a;
}
else
{
int MAX = arr[n - 1];
if (MAX == 1)
{
cout << "No\n";
goto a;
}
if (arr[0] != 1 || arr[1] != 1)
{
cout << "No\n";
goto a;
}
else
{
for (int i = 2; i < n; i++)
{
if (arr[i] == MAX)
continue;
else if (arr[i] - arr[i - 1] > 2)
{
cout << "No\n";
goto a;
}
}
}
}
cout << "Yes\n";
}
}
ZOJ 3959 Problem Preparation 【水】的更多相关文章
- fzuoj Problem 2182 水题
http://acm.fzu.edu.cn/problem.php?pid=2182 Problem 2182 水题 Accept: 188 Submit: 277Time Limit: 100 ...
- 2017浙江省赛 B - Problem Preparation ZOJ - 3959
地址:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3959 题目: It's time to prepare the pr ...
- 烟大 Contest1024 - 《挑战编程》第一章:入门 Problem A: The 3n + 1 problem(水题)
Problem A: The 3n + 1 problem Time Limit: 1 Sec Memory Limit: 64 MBSubmit: 14 Solved: 6[Submit][St ...
- Poj1298_The Hardest Problem Ever(水题)
一.Description Julius Caesar lived in a time of danger and intrigue. The hardest situation Caesar eve ...
- [POJ 1000] A+B Problem 经典水题 C++解题报告 JAVA解题报告
A+B Problem Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 311263 Accepted: 1713 ...
- ZOJ 2723 Semi-Prime ||ZOJ 2060 Fibonacci Again 水水水!
两题水题: 1.如果一个数能被分解为两个素数的乘积,则称为Semi-Prime,给你一个数,让你判断是不是Semi-Prime数. 2.定义F(0) = 7, F(1) = 11, F(n) = F( ...
- zoj Abs Problem
Abs Problem Time Limit: 2 Seconds Memory Limit: 65536 KB Special Judge Alice and Bob is pl ...
- HDOJ(HDU) 1898 Sempr == The Best Problem Solver?(水题、、、)
Problem Description As is known to all, Sempr(Liangjing Wang) had solved more than 1400 problems on ...
- Prime Ring Problem(dfs水)
题目连接:http://acm.hdu.edu.cn/showproblem.php?pid=1016 Prime Ring Problem Time Limit: 4000/2000 MS (Jav ...
随机推荐
- Mockito - Wanted but not invoked: Actually, there were zero interactions with this mock
要测试的类:IndexController.java 代码: @Mock private TemplateWrapper templateWrapper = spy(new TemplateWrapp ...
- hibernate配置文件再写
hibernate配置文件主要用于配置数据库连接和hibernate运行时所需的各种属性,每个hibernate配置文件对应一个Configuration对象,hibernate的配置文件有两种格式, ...
- 敲敲SQL语句
基本命令 查看数据库:show databases; 选择数据库:use mysql_crash; 连接数据库:需要:主机名,端口,合法用户名,用户口令 mysql -u ben -p -h loca ...
- TP5 Session Db驱动
一.下载附件,解压,文件路径\extend\driver\session\Db.php 驱动文件下载:Db.php 二.创建数据表 DROP TABLE IF EXISTS `platform_ses ...
- [搬家]新域名 akagi201.org
现在感觉自己做了好多年的垃圾信息制造者 以后只在网络上发布有用的东西, 垃圾或者对别人没用的东西就放到自己的硬盘上把 http://akagi201.org
- 通过Bag一对多映射示例(使用xml文件)
如果持久化类具有包含实体引用的列表对象,则需要使用一对多关联来映射列表元素. 我们可以通过列表(list)或包(bag)来映射这个列表对象. 请注意,bag不是基于索引的,而list是基于索引的. 在 ...
- python学习---简介
http://www.cnblogs.com/wuguanglei/p/3866583.html http://www.cnblogs.com/wuguanglei/p/3866583.html ok ...
- Google Careers 程序员必修课
quote from : https://www.google.com/about/careers/students/guide-to-technical-development.html Techn ...
- C++实现文件关联
下面这段话是百度百科对文件关联的解释. 文件关联就是将一种类型的文件与一个可以打开它的程序建立起一种依存关系.举个例子来说,位图文件(BMP文件)在Windows中的默认关联程序是“画图”,如果将其默 ...
- 多线程编程中的join函数
# coding: utf-8 # 测试多线程中join的功能 import threading, time def doWaiting(): print 'start waiting1: ' + t ...