Round 236 div.1

    A:只需要每个点连接所有比他大的点,知道边用完为止。  

//By BLADEVIL
#include <cmath>
#include <cstdio>
#define maxn 25;

using namespace std;


int main() {
    int task; scanf("%d",&task);
    while (task--) {
        int n,p; scanf("%d%d",&n,&p);
        int rest(2*n+p);
        for (int i=1;(i<=n)&&rest;i++)
            for (int j=i+1;(j<=n)&&rest;j++) printf("%d %d\n",i,j),rest--;
    } 
    return 0;
}
View Code

相关文章:

  • 2022-01-03
  • 2022-01-03
  • 2021-10-07
  • 2021-07-24
  • 2021-07-03
  • 2022-01-07
  • 2021-11-17
猜你喜欢
  • 2021-08-29
  • 2021-06-26
  • 2021-12-24
  • 2021-12-24
  • 2021-12-24
  • 2021-12-24
  • 2021-08-18
相关资源
相似解决方案