CF_402C Searching for Graph 乱搞题
题目链接:http://codeforces.com/problemset/problem/402/C
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
/**算法分析: 乱搞题,不明白题目想考什么 */ #include<bits/stdc++.h> #define MAXN 1050 #define PI acos(-1.0) #define REP(i,n) for(int i=0; i<n; i++) #define FOR(i,s,t) for(int i=s; i<=t; i++) #define mem(a,b) memset(a,b,sizeof(a)) #define show(x) { cerr<<">>>"<<#x<<" = "<<x<<endl; } #define showtwo(x,y) { cerr<<">>>"<<#x<<"="<<x<<" "<<#y<<" = "<<y<<endl; } using namespace std; int main() { int T; cin>>T; while(T --) { int G[30][30]; mem(G,0); int n,p; cin>>n>>p; int sum = 2*n+p,k = 1; while(sum) { REP(i,n) { G[i][(i+k)%n] = G[(i+k)%n][i] = 1; sum--; if(!sum) break; } k++; } REP(i,n) FOR(j,i+1,n-1) { if(G[i][j]) cout<<i+1<<" "<<j+1<<endl; } } }