codeforces round #236 div.2 C
来源:互联网 发布:几比几的比例怎么算法 编辑:程序博客网 时间:2024/04/30 18:08
题目链接:http://codeforces.com/contest/402/problem/C
刚刚看了题目完全没有头绪,看了题解还是不理解为什么。但直接根据题解写代码A掉了。
最后想想,题解的思路是这样的:要得到满足条件的图,则应该让边尽可能的分布在每两个点之间。这样才能任选一部分点使得这部分构成的子图的边数的最大值尽可能小。
///2014.3.18///codeforces round #236 div.2///C#include <iostream>#include <cstdio>using namespace std;int main(){ // freopen("in","r",stdin); // freopen("out","w",stdout); int t; cin>>t; while( t-- ){ int n,p; cin>>n>>p; int NUM = 2*n+p; int i=1; int j=2; for(int num=0 ; num<NUM ; num++){ cout<<i<<' '<<j<<endl; j++; if(j>n){ i++; j = i+1; } } } return 0;}
0 0
- codeforces round #236 div.2 C
- 【codeforces】Codeforces Round #370 (Div. 2) C
- Codeforces Round #236 (Div. 2)
- Codeforces Round #236 (Div. 2)
- Codeforces Round #236 (Div. 2)
- Codeforces Round #236 (Div. 2)C. Searching for Graph
- Codeforces Round #105 (Div. 2) C
- Codeforces Round 134 div 2 C题
- Codeforces Round #137 (Div. 2), problem: (C)
- Codeforces Round #153 (Div. 2) C题
- Codeforces Round #158 (Div. 2) C题
- Codeforces Round #162 (Div. 2) C
- Codeforces Round #166 (Div. 2) c. Secret
- Codeforces Round#170(Div 2)C
- Codeforces Round #173 (Div. 2) Problem C
- Codeforces Round #192 (Div. 2) C. Purification
- Codeforces Round #196 (Div. 2) C. Quiz
- Codeforces Round #197 (Div. 2) (C~E)
- 2.Unix高级编程-----ls的实现
- 谈disruptor的单线程数据库操作
- 初学菜鸟的学习日记——继续低端(代理模式设计)
- [LeetCode] Swap Nodes in Pairs
- 【菜鸟学WCF】Wcf消息交换模式
- codeforces round #236 div.2 C
- apue.h包头找不到的问题
- mysql乱码问题
- Codeforces Round #237 Div.2 A
- OCP 1Z0 051 12
- Hibernate Annotation(注解)
- JQuery中2个等号与3个等号的区别
- 【Android数据存储】- File
- UML的关系