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 ...
随机推荐
- Java并发编程(十一)实例封闭
本节主题:如果一个类是线程不安全的,但是又要在多线程程序中安全地使用,你该怎么办? 大体有两种思路: 第一种:确保该对象是能由单个线程访问,也就是这个对象是被封闭在线程中的: 第二种:通过锁来对该对象 ...
- 搭建Windows Node.js环境
利Javascript做为服务端脚本,通过Nodejs框架web开发.Nodejs框架是基于V8的引擎,是目前速度最快的Javascript引擎.chrome浏览器就基于V8,同时打开20-30个网页 ...
- 放苹果(整数划分变形题 水)poj1664
问题:把M个相同的苹果放在N个相同的盘子里.同意有的盘子空着不放,问共同拥有多少种不同的分法?(用K表示)5,1,1和1,5,1 是同一种分法. 例子 : 1 7 3 ---------------8 ...
- python 开发技巧(3)-- 连接mysql 出现错误 ModuleNotFoundError: No module named 'MySQLdb'
python3中使用mysql报错ModuleNotFoundError: No module named 'MySQLdb' 原因是:在python2.x中用mysqldb,但是在python3.x ...
- mybatis like用法
针对不同的数据库,like的用法是不一样的,现在具体来说一下 1,SQL SERVER SELECT * FROM user WHERE name like '%'+#{name}+'%' 2,Ora ...
- 【转】Android自动化测试(UiAutomator)简要介绍
一.一个BUG引发的问题 如果研发过程中有一个BUG:“不断的切换手机语言出现花屏现象”.这个问题我们如何验证呢?我想,最好的方式应该是自动化测试. 那么,自动化测试可以完成哪些任务呢? ...
- Hibernate体系结构
Hibernate架构包括许多对象持久对象,会话工厂,事务工厂,连接工厂,会话,事务等. hibernate架构中有4层Java应用层,hibernate框架层,反手api层和数据库层.请参见hibe ...
- 福昕阅读器打开PDF文档速度慢
RT---------------- 操作如下两步可加快打开速度: 1.Program Files\Foxit Software\Foxit Reader下面的Shell Extensions文件夹删 ...
- IOS 键盘协议之中的一个 <UITextFieldDelegate>
1. 设置键盘的第一响应者后,便可通过点击TextField唤出键盘 设置键盘第一响应者方法为: [textField becomeFirstResponder];//此时,textField 输入框 ...
- 使用jquery-tmpl使JavaScript与HTML分离
背景:由于对JavaScript字符串拼接JavaScript变量产生了反感,也想用用JavaScript模板库,看了几个,由于时间原因选择了jQuery.tmpl.js,因为Visual Studi ...