为 啥 3 0 分
  • 板块P2089 烤鸡
  • 楼主luqyou
  • 当前回复4
  • 已保存回复4
  • 发布时间2022/1/13 10:42
  • 上次更新2023/10/28 12:26:55
查看原帖
为 啥 3 0 分
464732
luqyou楼主2022/1/13 10:42
#include<bits/stdc++.h>
using namespace std;
int x,ans;
int main(){
    cin>>x;
    //freopen("1.txt","w",stdout);
    for(int q=1;q<=3;q++){
        for(int w=1;w<=3;w++){
            for(int e=1;e<=3;e++){
                for(int r=1;r<=3;r++){
                    for(int t=1;t<=3;t++){
                        for(int y=1;y<=3;y++){
                            for(int u=1;u<=3;u++){
                                for(int i=1;i<=3;i++){
                                    for(int o=1;o<=3;o++){
                                        if(q+w+e+r+t+y+u+i+o==x) ans++;
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    cout<<ans<<endl;
    for(int q=1;q<=3;q++){
        for(int w=1;w<=3;w++){
            for(int e=1;e<=3;e++){
                for(int r=1;r<=3;r++){
                    for(int t=1;t<=3;t++){
                        for(int y=1;y<=3;y++){
                            for(int u=1;u<=3;u++){
                                for(int i=1;i<=3;i++){
                                    for(int o=1;o<=3;o++){
                                        if(q+w+e+r+t+y+u+i+o==x){
                                            cout<<q<<" "<<w<<" "<<e<<" "<<r<<" "<<t<<" "<<y<<" "<<u<<" "<<i<<" "<<o<<endl;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    return 0;
}
2022/1/13 10:42
加载中...