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 ...
随机推荐
- c#序列化和反序列化list
List<UserData> lstStuModel = new List<UserData>() { new UserData(){Name="001", ...
- erlang 洗牌 shuffle
很简单的一个场景:一副扑克(54张)的乱序洗牌 shuffle_list(List) -> [X || {_, X} <- lists:sort([{random:uniform(), N ...
- pom.xml settings.xml
<?xml version="1.0" encoding="UTF-8"?> <!-- Licensed to the Apache Soft ...
- python 面试题 string int
str1 = 'hello' str2 = str1 str3 = str1 str4 = str1 str1 = '' int1 = 1 int2 = int1 int3 = int1 int4 = ...
- selenium+testng+reportng+ant+jenkins集成日记
1.新建一个项目 2.编写测试脚本 3.配置ant的build.xml脚本 4.集成到jenkins,并运行 1.新建项目 注意jdk的版本要一致 eclipse Window --Prefer ...
- 正则表达式初识,re模块
作业收藏 # 3.reversed和sorted和list列表类型内置的sort.reverse有什么区别? #reversed 的返回值是一个迭代器并不会直接修改原列表 sorted的返回值是生成一 ...
- poj3481(splay tree 入门题)
平衡树都能做. // // main.cpp // splay // // Created by 陈加寿 on 16/3/25. // Copyright © 2016年 chenhuan001. A ...
- Sleep Buddies
Sleep Buddies time limit per test 2.0 s memory limit per test 256 MB input standard input output sta ...
- hadoop报错java.io.IOException: Bad connect ack with firstBadLink as 192.168.1.218:50010
[root@linuxmain hadoop]# bin/hadoop jar hdfs3.jar com.dragon.test.CopyToHDFS Java HotSpot(TM) Client ...
- text files and binary files
https://en.wikipedia.org/wiki/Text_file https://zh.wikipedia.org/wiki/文本文件