CodeForces 22C System Administrator
把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的更多相关文章
- codeforces 22C System Administrator(构造水题)
转载请注明出处: http://www.cnblogs.com/fraud/ ——by fraud System Administrator Bob got a job as a s ...
- 解决方法: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 ...
- Requirements of an SAP system administrator
Requirements of an SAP system administrator Have a "proper" attitude Protect and safeguard ...
- the account is currently locked out. The system administrator can unlock it.
今天遇到的问题比较有意思.首先是很久没有打开测试数据库了,今天打开,使用service程序测试的时候出现下面的错误提示:Message: System.Data.SqlClient.SqlExcept ...
- 解决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 ...
- 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. 今天遇到的问题比较有意思. ...
- The Windows account sa does not exist and cannot be provisioned as a SQL Server system administrator
今天遇到一个案例,在使用命令修改一个测试服务器(SQL Server 2014标准版)的服务器排序规则时,遇到了下面错误信息 (具体账号信息脱敏处理,随机生成一个账号密码) The Windows a ...
- 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 ...
- Sql server 账号被锁住:"the account is currently locked out. The system administrator can unlock it."的解决办法(转载)
今天遇到的问题比较有意思.首先是很久没有打开测试数据库了,今天打开,使用service程序测试的时候出现下面的错误提示:Message: System.Data.SqlClient.SqlExcept ...
随机推荐
- php中mysql语句的基本写法
php中mysql语句的基本写法 php作为一门后台语言必须要与mysql数据库打交道,做到将内容存储到数据库以及数据库数据读写的操作,那么下面就来说下最近学习的一些东西: 在具体将之前先说一下编码的 ...
- symfony的安装
Symfony 是一个基于MVC的PHP框架,最新版本为2.7 工作原理 Synfony安装的两种方法 1.使用composer进行安装 1)下载composer http://getcomposer ...
- python之字符串格式化(format)
用法: 它通过{}和:来代替传统%方式 1.使用位置参数 要点:从以下例子可以看出位置参数不受顺序约束,且可以为{},只要format里有相对应的参数值即可,参数索引从0开,传入位置参数列表可用*列表 ...
- python encode和decode函数说明【转载】
python encode和decode函数说明 字符串编码常用类型:utf-8,gb2312,cp936,gbk等. python中,我们使用decode()和encode()来进行解码和编码 在p ...
- 转:script中的async和defer
script中的async和defer defer: This Boolean attribute is set to indicate to a browser that the script is ...
- ulimit 说明
ulimit官方描述 Provides control over the resources available to the shell and to processes started by it ...
- The Suspects(并查集求节点数)
The Suspects Time Limit: 1000MS Memory Limit: 20000K Total Submissions: 28164 Accepted: 13718 De ...
- IOS系列——NStimer
Timer经常使用的一些东西 1. 初始化 timer = [NSTimer scheduledTimerWithTimeInterval:1 target:self selector:@select ...
- Extjs4 操作TreeStore 处理proxyAjax 获取的数据
近期在搞extjs4 TreeStore时有一个需求 就是要处理一下后台传过来的json数据然后再显示,看api也没有找到解决的方法 ,最后看源代码在Ext.data.proxy.Server 看到这 ...
- asp.net DropDownList的AppendDataBoundItems属性
个人笔记 当设置DropDownList的AppendDataBoundItems属性为true,是将数据绑定项追加到静态声明的列表上,即在绑定之前可加入静态列表项. 例如: 前台这么写: <a ...