构造图 Codeforces Round #236 (Div. 2) C. Searching for Graph
生活随笔
收集整理的這篇文章主要介紹了
构造图 Codeforces Round #236 (Div. 2) C. Searching for Graph
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
?
題目地址
1 /* 2 題意:要你構造一個有2n+p條邊的圖,使得,每一個含k個結點子圖中,最多有2*k+p條邊 3 水得可以啊,每個點向另外的點連通,只要不和自己連,不重邊就可以,正好2*n+p就結束:) 4 */ 5 #include <cstdio> 6 #include <iostream> 7 #include <algorithm> 8 #include <cstring> 9 #include <string> 10 #include <map> 11 #include <cmath> 12 using namespace std; 13 14 int main(void) //Codeforces Round #236 (Div. 2) C. Searching for Graph 15 { 16 //freopen ("B.in", "r", stdin); 17 18 int t; 19 scanf ("%d", &t); 20 while (t--) 21 { 22 int n, p; 23 scanf ("%d%d", &n, &p); 24 25 int cnt = 0, i = 1, j = 2; 26 while (cnt < 2 * n + p) 27 { 28 printf ("%d %d\n", i, j); 29 j++; cnt++; 30 if (j == n + 1) j = ++i + 1; 31 } 32 } 33 34 return 0; 35 }?
轉載于:https://www.cnblogs.com/Running-Time/p/4402284.html
總結
以上是生活随笔為你收集整理的构造图 Codeforces Round #236 (Div. 2) C. Searching for Graph的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: ImportError: No modu
- 下一篇: Nagios/Postfix 转发警报邮