zoukankan      html  css  js  c++  java
  • 谁干的好事

    #include <bits/stdc++.h>
    using namespace std;
    int main(){
        string s[32];
        int num,truth,a[5],flg=0,pq=0;
        int b[5];//做没做
        char c;
        cin>>num>>c>>truth;
        for(b[0]=0;b[0]<=1;b[0]++){for(b[1]=0;b[1]<=1;b[1]++){
            for(b[2]=0;b[2]<=1;b[2]++){for(b[3]=0;b[3]<=1;b[3]++){
                for(b[4]=0;b[4]<=1;b[4]++){
            string p;
            if(b[0]+b[1]+b[2]+b[3]+b[4]!=num) continue;
            if(b[0]+b[c-'A']==1) a[0]=1;
            else a[0]=0;
            if(b[2]+b[4]>0) a[1]=1;
            else a[1]=0;
            if(b[0]+b[2]+b[3]>0) a[2]=1;
            else a[2]=0;
            if(b[1]==0&&b[2]==0) a[3]=1;
            else a[3]=0;
            if(b[4]==0) a[4]=1;
            else a[4]=0;
            if(a[0]+a[1]+a[2]+a[3]+a[4]==truth){
                flg=1;
                for(int i=0;i<5;i++)
                if(b[i]) p.push_back(i+'A');
                s[pq++]=p;
            }
        }}}}}
        if(!flg) cout<<0<<endl;
        else{
            sort(s,s+pq);
            for(int i=0;i<pq;i++)
                cout<<s[i]<<endl;    
        }
        return 0;
    }
  • 相关阅读:
    fidller 打断点
    随笔
    HTML标签介绍
    补充9.27----9.28
    html5_______9.26
    9.14
    9.13笔记
    9.12笔记
    CSS样式的引用
    html5_______9.10
  • 原文地址:https://www.cnblogs.com/MorrowWind/p/13056504.html
Copyright © 2011-2022 走看看