所以可以暴力过呀
by Chloris @ 2018-09-14 22:16:23
还记得这种代码吗:```cpp
#include <iostream>
using namespace std;
int main(){
int a,b,c,d,e,f,g,h,i,j,ji,sum=0;
cin>>ji;
for (a=1;a<=3;a++)
for (b=1;b<=3;b++)
for (c=1;c<=3;c++)
for (d=1;d<=3;d++)
for (e=1;e<=3;e++)
for (f=1;f<=3;f++)
for (g=1;g<=3;g++)
for(h=1;h<=3;h++)
for (i=1;i<=3;i++)
for (j=1;j<=3;j++)
if (a+b+c+d+e+f+g+h+i+j==ji)
sum++;
cout<<sum<<endl;
for (a=1;a<=3;a++)
for (b=1;b<=3;b++)
for (c=1;c<=3;c++)
for (d=1;d<=3;d++)
for (e=1;e<=3;e++)
for (f=1;f<=3;f++)
for (g=1;g<=3;g++)
for(h=1;h<=3;h++)
for (i=1;i<=3;i++)
for (j=1;j<=3;j++)
if (a+b+c+d+e+f+g+h+i+j==ji)
{
cout<<a<<" ";
cout<<b<<" ";
cout<<c<<" ";
cout<<d<<" ";
cout<<e<<" ";
cout<<f<<" ";
cout<<g<<" ";
cout<<h<<" ";
cout<<i<<" ";
cout<<j<<endl;
}
}
```
by Register @ 2018-09-14 22:17:07
```cpp
#include <iostream>
using namespace std;
int main(){
int a,b,c,d,e,f,g,h,i,j,ji,sum=0;
cin>>ji;
for (a=1;a<=3;a++)
for (b=1;b<=3;b++)
for (c=1;c<=3;c++)
for (d=1;d<=3;d++)
for (e=1;e<=3;e++)
for (f=1;f<=3;f++)
for (g=1;g<=3;g++)
for(h=1;h<=3;h++)
for (i=1;i<=3;i++)
for (j=1;j<=3;j++)
if (a+b+c+d+e+f+g+h+i+j==ji)
sum++;
cout<<sum<<endl;
for (a=1;a<=3;a++)
for (b=1;b<=3;b++)
for (c=1;c<=3;c++)
for (d=1;d<=3;d++)
for (e=1;e<=3;e++)
for (f=1;f<=3;f++)
for (g=1;g<=3;g++)
for(h=1;h<=3;h++)
for (i=1;i<=3;i++)
for (j=1;j<=3;j++)
if (a+b+c+d+e+f+g+h+i+j==ji)
{
cout<<a<<" ";
cout<<b<<" ";
cout<<c<<" ";
cout<<d<<" ";
cout<<e<<" ";
cout<<f<<" ";
cout<<g<<" ";
cout<<h<<" ";
cout<<i<<" ";
cout<<j<<endl;
}
}
```
by Register @ 2018-09-14 22:17:30
刚刚Markdown出bug了
by Register @ 2018-09-14 22:17:54