2 条题解

  • 1
    @ 2018-12-11 12:01:17
    /*
    
    */
    #define method_2
    #ifdef method_1
    /*
    50分算法
    枚举a,b 直接判断 
    */
    #include<iostream>
    #include<cstdio>
    #include<algorithm>
    #include<cmath>
    #include<set>
    #include<map>
    #include<queue>
    #include<stack>
    #include<vector>
    #include<cstring>
    #include<cstdlib>
    using namespace std;
    typedef long long ll;
    const int maxn=+5;
    const ll INF=0x3f3f3f3f3f3f3f3fll;
    ll a1,b1,c1;
    bool check(int a,int b){
        if((a==a1)&&((a&b)==b1)&&((a|b)==c1)) return true;
        if((a==a1)&&((a&b)==c1)&&((a|b)==b1)) return true;
        if((a==b1)&&((a&b)==c1)&&((a|b)==a1)) return true;
        if((a==b1)&&((a&b)==a1)&&((a|b)==c1)) return true;
        if((a==c1)&&((a&b)==b1)&&((a|b)==a1)) return true;
        if((a==c1)&&((a&b)==a1)&&((a|b)==b1)) return true;
        return false;
    }
    int main() {
        ios::sync_with_stdio(false);
        freopen("偷拍硕哥5.in","r",stdin);
        cin>>a1>>b1>>c1;
        for(int i=0;i<=1000;i++){
            for(int j=0;j<=1000;j++){
                if(i==j) continue;
                if(check(i,j)){
                    cout<<i;
                    return 0;
                }
            }
        }
        return 0;
    }
    #endif
    #ifdef method_2
    /*
    100分算法 
    因为a不等于b 
    所以a|b是最大的数 
    a&b是最小的数 
    */
    #include<iostream>
    #include<cstdio>
    #include<algorithm>
    #include<cmath>
    #include<set>
    #include<map>
    #include<queue>
    #include<stack>
    #include<vector>
    #include<cstring>
    #include<cstdlib>
    using namespace std;
    typedef long long ll;
    const int maxn=+5;
    const ll INF=0x3f3f3f3f3f3f3f3fll;
    ll a[5];
    
    int main() {
        ios::sync_with_stdio(false);
    //  freopen("偷拍硕哥5.in","r",stdin);
        cin>>a[0]>>a[1]>>a[2];
        sort(a,a+3);
        cout<<a[1];
        return 0;
    }
    #endif
    #ifdef method_3
    /*
    
    */
    
    #endif
    
    
  • 0
    @ 2021-04-19 12:13:59

    #include<iostream>
    using namespace std;
    int main()
    {
    int a, b, c;
    int x[3];
    for (int i = 0; i < 3; i++)
    {
    cin >> x[i];
    }
    int temp;
    for(int i=0;i<3;i++)
    for (int j = i+1; j < 3; j++)
    {
    if (x[i] > x[j])
    {
    temp = x[i];
    x[i] = x[j];
    x[j] = temp;
    }
    }
    cout << x[1];
    return 0;
    }

  • 1

信息

难度
2
分类
(无)
标签
(无)
递交数
99
已通过
56
通过率
57%
被复制
4
上传者