把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. The number of positions

    Description The number of positions time limit per test: 0.5 second memory limit per test: 256 megab ...

  2. sqlite3编译与查询

    1.sqlite3 http://www.sqlite.org/ 下载 wget http://www.sqlite.org/2014/sqlite-amalgamation-3080403.zip ...

  3. Robot Framework中DatabaseLibrary应用

    DatabaseLibrary: 在RF的官网上,有DatabaseLibrary的下载链接,DatabaseLibrary有2个版本,Python和Java版.本人使用的是Python版本. 1.下 ...

  4. android一分钟学会可视化操作数据库(无需ROOT)

    我刚开始弄android数据库的时候,想查询一些数据,以验证程序逻辑,发现很多方案都需要ROOT. 即便有不需要ROOT的方案,命令行交互也比较麻烦. 今天跟大家分享一下这个点点鼠标就能实现的功能. ...

  5. 转:script中的async和defer

    script中的async和defer defer: This Boolean attribute is set to indicate to a browser that the script is ...

  6. uvalive5818 uva12376 As Long as I Learn, I Live

    题意:给出一个又向图每个图有权值和编号(正方形里的是编号),从第0号节点开始每次向当前节点所连的点中权值最大的节点移动(不会存在权值相同的节点),问最后所在的节点编号和经过的节点的权值之和. 解:模拟 ...

  7. css之float

    在 HTML中的所有对象,默认分为两种:块元素(block element).内联元素(inline element),虽然也存在着可变元素,但只是随上下文关系确定该元素是块元素或者内联元素. 其实C ...

  8. bootstrap-dialog的使用

    <!doctype html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  9. 将外部准备好的sqlite导入到项目当中

    首先,将sqlite数据库文件放在Resource文件夹下,并且允许其编译到项目当中. 之后在AppDelegate当中执行一些代码,这里将代码封装了一个Helper: #import "R ...

  10. [MOC062066]背景建模资料收集整理

    一.相关博客 背景建模相关资料收集,各个链接都已给出. 资料,不可能非常完整,以后不定期更新. -----------------切割线----------------- 这个哥们总结的非常好啊,看完 ...