首页 > 其他 > 详细

ZOJ 3959: Problem Preparation

时间:2017-08-06 23:35:32      阅读:245      评论:0      收藏:0      [点我收藏+]

Problem Preparation

///@author Sycamore, ZJNU
///@date 4/22/2017
#include <iostream>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <string>
#include <algorithm>
#include <numeric>
#include <functional>
#include <vector>
#include <set>
#include <list>
#include <stack>
#include <queue>
#include <map>
#include <algorithm>
#include <cctype>
#include<fstream>
//#define cin fin
//#define cout fout
//ifstream fin("in.txt");
//ofstream fout("out.txt");
using namespace std;
typedef vector<int> VI;
typedef pair<int, int> PII;
int main()
{
	ios::sync_with_stdio(false);
	int T;
	cin >> T;
	while (T--)
	{
		int k = 0, t = 0;
		int n;
		cin >> n;
		vector<int>s(n);
		for (auto &e : s)cin >> e;
		bool fg = true;
		if (n < 10 || n>13)fg = false;
		else if (*min_element(s.begin(), s.end()) != 1)
		{
			fg = false;
		}
		else if (count(s.begin(), s.end(), 1)<2)
		{
			fg = false;
		}
		else {
			sort(s.begin(), s.end());
			for (int i = 0; i < n - 2; i++)
			{
 
				if (abs(s[i] - s[i + 1]) > 2)
				{
					fg = false;
					break;
				}
			}
		}
		if (fg)cout << "Yes\n";
		else cout << "No\n";
	}
	return 0;
} 

ZOJ 3959: Problem Preparation

原文:http://www.cnblogs.com/zjnu/p/7296314.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!