题意:
略。
思路:
一开始想DFS直接搜出来,然后打表。。然后n=15的时候跑不出来了。。。。
原来那么简单:
所以每次推一推就好了,嘤嘤嘤,大水题想了半天。
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
using namespace std;
int a[20][20]={
{2,3,6},
{2,4,6,12},
{2,4,8,12,24},
{3,4,6,8,12,24},
{2,6,8,12,16,24,48},
{3,4,6,12,15,20,30,60},
{3,4,7,12,14,21,28,42,84},
{3,5,6,8,20,24,30,40,60,120},
{3,5,8,10,15,20,24,30,40,60,120},
{4,5,8,10,12,15,20,24,30,40,60,120},
{3,6,9,10,15,18,20,30,36,45,60,90,180},
{4,6,9,10,12,15,18,20,30,36,45,60,90,180},
{3,5,6,16,28,33,36,39,42,45,48,56,70,88,130},
{3,5,6,16,33,36,39,42,44,45,48,56,70,77,88,130},
{3,5,6,20,33,36,39,42,44,45,48,56,70,77,80,88,130},
{3,5,6,24,33,36,39,42,44,45,48,56,70,77,80,88,120,130},};
int main()
{
for(int i=0,n=3;n<=18;i++,n++)
{
for(int j=0;j<n;j++)
{
if(j) printf(" ");
printf("%d",a[i][j]);
}
puts("");
}
}