10次循环并没有超时呢。。。。

P2089 烤鸡

暴力出奇迹~~~ ```cpp #include<iostream> using namespace std; int n,tot=0; int main() { cin>>n; for(int a=1;a<=3;a++) for(int b=1;b<=3;b++) for(int c=1;c<=3;c++) for(int d=1;d<=3;d++) for(int e=1;e<=3;e++) for(int f=1;f<=3;f++) for(int g=1;g<=3;g++) for(int h=1;h<=3;h++) for(int i=1;i<=3;i++) for(int j=1;j<=3;j++) if(a+b+c+d+e+f+g+h+i+j==n)tot++; cout<<tot<<endl; for(int a=1;a<=3;a++) for(int b=1;b<=3;b++) for(int c=1;c<=3;c++) for(int d=1;d<=3;d++) for(int e=1;e<=3;e++) for(int f=1;f<=3;f++) for(int g=1;g<=3;g++) for(int h=1;h<=3;h++) for(int i=1;i<=3;i++) for(int j=1;j<=3;j++) if(a+b+c+d+e+f+g+h+i+j==n) cout<<a<<' '<<b<<' '<<c<<' '<<d<<' '<<e<<' '<<f<<' '<<g<<' '<<h<<' '<<i<<' '<<j<<endl; return 0; } 我感到快乐~~~ ```
by 横扫千军 @ 2017-09-20 22:30:07


eee
by 逃课小姐MS @ 2017-10-11 20:51:32


3的十次方怎么会炸...
by Finale @ 2017-10-27 14:24:58


这个绝对不会炸
by 我爱罗 @ 2017-11-28 22:42:00


|