博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
URAL 1779 F - The Great Team 构造
阅读量:4681 次
发布时间:2019-06-09

本文共 2344 字,大约阅读时间需要 7 分钟。

F - The Great Team

Time Limit: 20 Sec

Memory Limit: 256 MB

题目连接

http://acm.hust.edu.cn/vjudge/contest/view.action?cid=87643#problem/F

Description

When a few students of the Ural State University finished their sport career, the university encountered a lot of problems in team composition. Veterans of sports programming decided to play their role and create the most successful team in the history of the Ural SU.

Veterans assumed that success of a team strongly depends on the number of friends in the ACM community the members of this team have. After more discussions they developed the criterion of success: all three members of the team should have the same number of friends.
Unfortunately, the veterans failed to compose a team, as it turned out that there were no three programmers in the Ural SU that together satisfied this criterion.
You should use this information to determine which students are friends of each other.

 

Input

The first line contains a single integer n (3 ≤ n ≤ 200) , which is the number of students in the Ural SU participating in programming contests.

Output

If the veterans' calculations are correct, the first line should contain an integer k, which is the number of pairs of students that are friends of each other. The following k lines should contain these pairs. Students should be numbered 1 through n. If a problem has multiple correct answers, output any of them.

If the veterans are wrong and the problem has no solution, output a single line containing a number −1.

Sample Input

4

Sample Output

2

1 3
3 4

HINT

 

题意

有n个点,然后让你构造一个图,使得每种度数的点,都不超过3个

题解

每个点,都从i一直连到n-i+1就好了

代码:

#include 
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
typedef unsigned char byte;#define pb push_back#define input_fast std::ios::sync_with_stdio(false);std::cin.tie(0)#define local freopen("in.txt","r",stdin)#define pi acos(-1)using namespace std;const int maxn = 200 + 50;int n;int degree[maxn];struct node{ int x,y;};vector
ans;int main(int argc,char *argv[]){ cin>>n; for(int i=1;i<=n;i++) { for(int j=i+1;j<=n-i+1;j++) { node k; k.x=i,k.y=j; ans.push_back(k); } } cout<
<

 

转载于:https://www.cnblogs.com/qscqesze/p/4728608.html

你可能感兴趣的文章
Sql查询语句过滤重复的数据
查看>>
mac 上iterm终端连接Linux服务后 中文为乱码问题
查看>>
MyBatis 【增删改查】
查看>>
重新编译jdk,使其带有调试信息
查看>>
python-map的用法
查看>>
添加一条公告并标记为已读
查看>>
redisCheckMem脚本
查看>>
CORS简介
查看>>
codeforces 1148E- Earth Wind and Fire
查看>>
fastjson转换json时,碰到的那些首字母大小写转换的坑!(转)
查看>>
Python3.6+pyinstaller+Django
查看>>
PowerDesigner使用教程
查看>>
ORACLE安装入门篇OEL5.4安装ORACLE11g
查看>>
聚类算法学习笔记(一)——基础
查看>>
Node.js 调用 restful webservice
查看>>
DirectX11--HR宏关于dxerr库的替代方案
查看>>
NOI 2005 瑰丽华尔兹(三维DP + 单调队列优化)
查看>>
【并查集模板】 【洛谷P2978】 【USACO10JAN】下午茶时间
查看>>
POJ3664
查看>>
一句话介绍python线程、进程和协程
查看>>