把v和2结点交换,

1和v连,其它点和v之间能够互相连。

#include <iostream>
#include <cstdlib>
#include <cstring>
#include <string>
#include <cstdio>
#include <cmath>
#include <algorithm>
using namespace std; int n,m,v,flag,i,cnt,j; int main()
{
while(~scanf("%d%d%d",&n,&m,&v))
{
flag=0;
if((n-1)*(n-2)/2+1<m) flag=1;
if(m<n-1) flag=1;
if(flag)
{
printf("-1\n");
continue;
}
cnt=n-1;
for(i=1;i<n;i++)
{
if(i==2) printf("%d ",v);
else if(i==v) printf("%d ",2);
else printf("%d ",i);
if(i+1==2) printf("%d\n",v);
else if(i+1==v) printf("%d\n",2);
else printf("%d\n",i+1);
}
for(i=2;i<n&&cnt!=m;i++)
{
for(j=i+2;j<=n&&cnt!=m;j++)
{
cnt++;
if(i==2) printf("%d ",v);
else if(i==v) printf("%d ",2);
else printf("%d ",i);
if(j==2) printf("%d\n",v);
else if(j==v) printf("%d\n",2);
else printf("%d\n",j);
}
}
}
return 0;
}

CodeForces 22C System Administrator的更多相关文章

  1. codeforces 22C System Administrator(构造水题)

    转载请注明出处: http://www.cnblogs.com/fraud/          ——by fraud System Administrator Bob got a job as a s ...

  2. 解决方法:An error occurred on the server when processing the URL. Please contact the system administrator

    在WINDOWS7或SERVER2008上安装了IIS7.5,调试ASP程序时出现以下错误: An error occurred on the server when processing the U ...

  3. Requirements of an SAP system administrator

    Requirements of an SAP system administrator Have a "proper" attitude Protect and safeguard ...

  4. the account is currently locked out. The system administrator can unlock it.

    今天遇到的问题比较有意思.首先是很久没有打开测试数据库了,今天打开,使用service程序测试的时候出现下面的错误提示:Message: System.Data.SqlClient.SqlExcept ...

  5. 解决IIS7运行ASP提示错误:An error occurred on the server when processing the URL. Please contact the system administrator

    原文:解决IIS7运行ASP提示错误:An error occurred on the server when processing the URL. Please contact the syste ...

  6. SQL点滴8—the account is currently locked out. The system administrator can unlock it.

    原文:SQL点滴8-the account is currently locked out. The system administrator can unlock it. 今天遇到的问题比较有意思. ...

  7. The Windows account sa does not exist and cannot be provisioned as a SQL Server system administrator

    今天遇到一个案例,在使用命令修改一个测试服务器(SQL Server 2014标准版)的服务器排序规则时,遇到了下面错误信息 (具体账号信息脱敏处理,随机生成一个账号密码) The Windows a ...

  8. cvsnt报错:Administrator: Switch to user failed due to configuration error. Contact your System Administrator

    在安装CVSNT一开始用Administrator登录时总是报[login aborted]Switch to user failed due to configuration error. Cont ...

  9. Sql server 账号被锁住:"the account is currently locked out. The system administrator can unlock it."的解决办法(转载)

    今天遇到的问题比较有意思.首先是很久没有打开测试数据库了,今天打开,使用service程序测试的时候出现下面的错误提示:Message: System.Data.SqlClient.SqlExcept ...

随机推荐

  1. hdu 2276 Kiki & Little Kiki 2 矩阵快速幂

    题目链接 n个灯围成一圈, 1左边是n. 有两种状态, 1是亮, 0是不亮. 如果一个灯, 它左边的灯是亮的, 那么下一时刻这个灯就要改变状态, 1变为0, 0变为1. 给出初始状态和时间t, 问t时 ...

  2. 学习iOS开发的前言

    一.什么是iOS 要想学习iOS开发,首先要搞清楚什么是iOS.iOS其实是一款操作系统,就像平时我们在电脑上用的XP.Win7,都是操作系统. 那什么是操作系统呢?操作系统其实是一种软件,是直接运行 ...

  3. XDocument读取xml的所有元素以及XPath语法

    原文  http://www.cnblogs.com/xxyishutong/p/3326375.html <?xml version="1.0" encoding=&quo ...

  4. 每天学点Linux:一

    软链接和硬链接: 软链接,又称符号链接,它的原理是通过一个文本文件记录真实文件在系统中的位置,然后在文件操作的时候通过该地址查找原文件然后对其操作.类似于Windows里面的快捷方式.软链接可以链接不 ...

  5. PHPExcel 多工作表 导入

    //参数初始化 $filePath = ''; if ($_FILES["file"]["error"] > 0) { returnJSON(ERROR_ ...

  6. cdoj 847 方老师与栈 火车进出战问题

    //其实我是不想写这题的,但是这题让我想起了我年轻的时候 解法:直接模拟栈就好. //另外我年轻时候做的那题数据范围比较小,原理也不一样. //对于序列中的任何一个数其后面所有比它小的数应该是倒序的, ...

  7. codeforces #286 Div.2 C DP总是以意外的方式打败我

    题目大意:30001个岛排成一排,编号从0到30000,一共有n个宝物分散在这些岛上,一只猪最开始从0跳到d,之后每一步跳的步长和上一步相差不超过1,第二步步长就是d-1,d,d+1,第二步的位置就是 ...

  8. 简单实现计算Edit Distance算法

    最近因为工作需要,学习了NLP的相关知识,简单动手实现了一下计算Edit Distance的算法,就是计算一个字符串要变成另一个字符串需要的代价,这其中采用Levenshtein方式,即规定一个插入和 ...

  9. leetcode_question_85 Largest Rectangle in Histogram

    Given n non-negative integers representing the histogram's bar height where the width of each bar is ...

  10. HTML之学习笔记(十)表单元素

    html表单元素的基本格式为(必须包含在form标签中)