#include <iostream>
#include <vector> using namespace std; int main(){
int n,m;
cin >> n >> m;
vector< bool > flag(n+,false);
for(int i = ; i < m ; i ++ ){
int a,b;
cin >> a>>b;
flag[a]=flag[b]=true;
}
int centerPoint = ;
for(int i = ; i <= n ; i ++ ){
if(!flag[i]){
centerPoint = i;
break;
}
}
cout<<n-<<endl;
for(int i = ; i <= n ; i ++ ){
if(i!=centerPoint) cout<<i<<" "<<centerPoint<<endl;
}
return ;
}

主要思路:就是一个中心点,其余的点都挂在上面

Codeforces Round #192 (Div. 2) B. Road Construction的更多相关文章

  1. Codeforces Round #192 (Div. 2) (330B) B.Road Construction

    题意: 要在N个城市之间修建道路,使得任意两个城市都可以到达,而且不超过两条路,还有,有些城市之间是不能修建道路的. 思路: 要将N个城市全部相连,刚开始以为是最小生成树的问题,其实就是一道简单的题目 ...

  2. Codeforces Round #353 (Div. 2) D. Tree Construction 模拟

    D. Tree Construction 题目连接: http://www.codeforces.com/contest/675/problem/D Description During the pr ...

  3. 数据结构 - Codeforces Round #353 (Div. 2) D. Tree Construction

    Tree Construction Problem's Link ------------------------------------------------------------------- ...

  4. Codeforces Round #353 (Div. 2) D. Tree Construction 二叉搜索树

    题目链接: http://codeforces.com/contest/675/problem/D 题意: 给你一系列点,叫你构造二叉搜索树,并且按输入顺序输出除根节点以外的所有节点的父亲. 题解: ...

  5. Codeforces Round #353 (Div. 2) D. Tree Construction (二分,stl_set)

    题目链接:http://codeforces.com/problemset/problem/675/D 给你一个如题的二叉树,让你求出每个节点的父节点是多少. 用set来存储每个数,遍历到a[i]的时 ...

  6. Codeforces Round #192 (Div. 1) C. Graph Reconstruction 随机化

    C. Graph Reconstruction Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/3 ...

  7. Codeforces Round #192 (Div. 1) B. Biridian Forest 暴力bfs

    B. Biridian Forest Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/329/pr ...

  8. Codeforces Round #192 (Div. 1) A. Purification 贪心

    A. Purification Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/329/probl ...

  9. [Codeforces Round #192 (Div. 2)] D. Biridian Forest

    D. Biridian Forest time limit per test 2 seconds memory limit per test 256 megabytes input standard ...

随机推荐

  1. 使用JDBC获取各数据库的Meta信息——表以及对应的列

    先贴代码,作为草稿: 第一个是工具类, MapUtil.java [java] view plain copy import java.util.ArrayList; import java.util ...

  2. Effecvtive C++笔记:让自己习惯C++

    条款01:视C++为一个语言联绑 C++的四个语言层次: C:C++是以C为基础的.基本数据类型.语句.预处理器.数组.指针等统统来自C. Oject-Oriented C++:面向对象这一特性包含了 ...

  3. php扩展开发初探

    2015年2月26日 15:44:41 原因: 想用PHP实现一个布隆过滤器算法, 其中要用到位运算, 但是PHP的内置的int类型不给力, 不能支持大整数的位运算 数据一旦太大, 就会变为浮点数表示 ...

  4. 类似于fopen与fopen64的种种情况

    在Linux和unix系统中,我们会遇到¥和¥64的情况.比如stat64,fopen64等 fopen64是linux特有 的,fopen64()函数和fopen()函数相同的,只是底层的文件描述符 ...

  5. Android手势锁实现

    最终效果如下 整体思路 a.自定义了一个RelativeLayout(GestureLockViewGroup)在里面会根据传入的每行的个数,生成多个GestureLockView(就是上面一个个小圈 ...

  6. MySQL auto-extending data file

    http://blog.csdn.net/hw_libo/article/details/39215723 http://blog.sina.com.cn/s/blog_5037eacb0102vjm ...

  7. HTML 学习新理论

    一直觉得没有时间,现在看到这样的网站: Bootstrap学习http://www.runoob.com/bootstrap/bootstrap-environment-setup.html Less ...

  8. ThinkPHP去除url中的index.php

    例如你的原路径是 http:.httpd.conf配置文件中加载了mod_rewrite.so模块  .AllowOverride None 讲None改为 All      .确保URL_MODEL ...

  9. PHPcms怎么调用二级栏目

    {pc:content action=" siteid="$siteid" order="listorder ASC"}             {l ...

  10. node.js简单的页面输出

    在node.js基本上没有兼容问题(如果你不是从早期的node.js玩起来),而且原生对象又加了这么多扩展,再加上node.js自带的库,每个模块都提供了花样繁多的API,如果还嫌不够,github上 ...