【构造】 Codeforces 476D Dreamoon and Sets
题意:构造出N 组 每组四个数中两两的GCD为 M 并且要求其中最大的数最小
则构造出4个互质的数再乘上M 即可
因 3个连续的奇数之间互质
奇数开始的3个连续的数互质 所以从1开始 取三个连续的奇数和
x x+2 x+4 and x+1
#include <cstdio> #include <iostream> #include <algorithm> using namespace std; int main() { int x,y; cin>>x>>y; int c=1; cout<<(5+(x-1)*6)*y<<endl; for(int i=0;i<x;i++) { printf("%d %d %d %d\n",c*y,(c+1)*y,(c+2)*y,(c+4)*y); c+=6; } return 0; }