CF192div2-330B - Road Construction
题意:给定n个城市并建造马路是的两两到达,且距离不能超过2
因为0<=m<n/2,所以必然存在某个城市是无限制的,那就可以以这个无限制的城市为中心建造。。。。
只要想通了真尼玛简单。。。。。。没想通真烦。。。。。。。。。。
#include<stdio.h>
#include<string.h>
const int maxn = ;
int ind[ maxn ];
int main(){
int n,m;
while( scanf("%d%d",&n,&m)== ){
memset( ind,,sizeof( ind ) );
int a,b;
while( m-- ){
scanf("%d%d",&a,&b);
ind[a]++;
ind[b]++;
}
int f;
for( int i=;i<=n;i++ ){
if( ind[i]== ){
f = i;
break;
}
}
printf("%d\n",n-);
for( int i=;i<=n;i++ ){
if( i==f ) continue;
printf("%d %d\n",f,i);
}
}
return ;
}
CF192div2-330B - Road Construction的更多相关文章
- POJ3352 Road Construction(边双连通分量)
...
- POJ3352 Road Construction (双连通分量)
Road Construction Time Limit:2000MS Memory Limit:65536KB 64bit IO Format:%I64d & %I64u Sub ...
- poj 3352 Road Construction【边双连通求最少加多少条边使图双连通&&缩点】
Road Construction Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 10141 Accepted: 503 ...
- POJ 3177 Redundant Paths POJ 3352 Road Construction(双连接)
POJ 3177 Redundant Paths POJ 3352 Road Construction 题目链接 题意:两题一样的.一份代码能交.给定一个连通无向图,问加几条边能使得图变成一个双连通图 ...
- POJ3352 Road Construction 双连通分量+缩点
Road Construction Description It's almost summer time, and that means that it's almost summer constr ...
- 【Tarjan缩点】PO3352 Road Construction
Road Construction Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 12532 Accepted: 630 ...
- POJ P3352 Road Construction 解题报告
P3352 Road Construction 描述 这几乎是夏季,这意味着它几乎是夏季施工时间!今年,负责岛屿热带岛屿天堂道路的优秀人士,希望修复和升级岛上各个旅游景点之间的各种道路. 道路本身也很 ...
- [POJ3352]Road Construction
[POJ3352]Road Construction 试题描述 It's almost summer time, and that means that it's almost summer cons ...
- POJ-3352 Road Construction,tarjan缩点求边双连通!
Road Construction 本来不想做这个题,下午总结的时候发现自己花了一周的时间学连通图却连什么是边双连通不清楚,于是百度了一下相关内容,原来就是一个点到另一个至少有两条不同的路. 题意:给 ...
- 【Aizu - 2249】Road Construction(最短路 Dijkstra算法)
Road Construction Descriptions Mercer国王是ACM王国的王者.他的王国里有一个首都和一些城市.令人惊讶的是,现在王国没有道路.最近,他计划在首都和城市之间修建道路, ...
随机推荐
- lrzsz on linux
Linux Disibutaion:Ubuntu 16.04.1 LTS lrzsz是一款在linux里可代替ftp上传和下载的程序. 1.下载lrzsz源码包 #下载源码包 wget https:/ ...
- 安装Numpy和matplotlib
(1)测试程序 这是我从网上(http://www.open-open.com/lib/view/open1393488232380.html)找到的一个使用Numpy和matplotlib的 ...
- 一个类似repo的小程序
#! /usr/bin/env python # -*- coding: utf-8 -*- # usage : python EasyRepo.py -u "13051041" ...
- percent-encode 百分号编码
原文地址:http://www.imkevinyang.com/2009/08/详解javascript中的url编解码.html 摘要 URI(统一资源标识)编解码 为什么需要编码 哪些需要编码 如 ...
- ASP.NET 常识
1..NET是什么? .Net全称.NET Framework是一个开发和运行环境, 该战略是微软的一项全新创意, 它将使得"互联网行业进入一 ...
- 函数-头文件//Calculator.h
// // Calculator.h // 函数-头文件 // // Created by zhangxueming on 15/6/2. // Copyright (c) 2015年 zhangxu ...
- 判断手机还是PC浏览器
function goPAGE() { if ((navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobi ...
- java集合框架示例图
- POJ 1050 To the Max -- 动态规划
题目地址:http://poj.org/problem?id=1050 Description Given a two-dimensional array of positive and negati ...
- Headfirst设计模式的C++实现——组合模式(Composite)
menu_component.h #ifndef _MENU_COMPONENT_H_ #define _MENU_COMPONENT_H_ #include <string> class ...