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 ...
随机推荐
- acdream 1157Segments cdq分治
题目链接 #include <iostream> #include <vector> #include <cstdio> #include <cstring& ...
- C#.NET中的CTS、CLS和CLR
以下内容来自:http://www.cnblogs.com/zagelover/articles/2741370.html 在学习.NET的过程中,都会不可避免地接触到这三个概念,那么这三个东西是什么 ...
- UberX及以上级别车奖励政策(优步北京第二、三组)
优步北京第二.三组: 定义为2015年6月1日至7月19日激活的司机(以优步后台数据显示为准) 滴滴快车单单2.5倍,注册地址:http://www.udache.com/如何注册Uber司机(全国版 ...
- How to Type(dp)
How to Type Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Tota ...
- 神奇的i=i++
最近在看c语言,被神奇的i=i++吸引,其实感觉编程是一件有趣的事情(特别喜欢算法).下面是我的测试,linux 下 gcc编译 #include<stdio.h> main () { ...
- android退出activity的方式总结(一)
在android中使用:[activityname].this.finish(); 只是退出了activity的堆栈中,要真正的退出程序在手机cpu中的运行,当应用不再使用时,通常需要关闭应用,可以 ...
- Android开源资料大集合_架构&UI
1. Anroid开源框架架 https://github.com/kymjs/KJFrameForAndroidhttp://www.oschina.net/p/thinkandroid http: ...
- apk混淆打包注意事项
混淆打包搞了好几天才初步了解,其中碰到很多Debug正常,Release的apk不能用,基本都是第三方的jar的问题,所以要排除混淆. 1. Json解析对象出错 用到fastJson或者GJson的 ...
- Sql Sever 字符串截取汉字
最近需要在SQL的字符串中截取汉字,利用unicode函数判断字符的unicode编码,根据编码范围过滤掉非汉字字符. 写成了一个function /*@str 需要获取汉字的字符串*/ create ...
- [C#技术参考]在PictureBox 中绘图防止闪烁的办法
开篇之前说点别的,马上年终了,好希望年终奖大大的,但是好像这次项目的展示很重要,所以这几天绷得比较近,但是真的没有感觉烦,就是害怕来不及.所以抓紧了.下面直接正题.说一下用到的东西,都是Google搜 ...