感受到了div.3的友好度

A题先求出三数最大值,然后判断有多少个数等于,如果个数大于等于,则对于第个数输出为,否则的话最大值输出,其他数输出

LL t;
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin>>t;
    while(t--){
        LL a,b,c;
        cin>>a>>b>>c;
        LL a1=max(a,b),a2=max(b,c);
        LL temp=max(a1,a2);
        LL res=(a==temp)+(b==temp)+(c==temp);
        if(res>1)res=1;
        else res=0;
        if(a==temp)
        cout<<temp+res-a<<" ";
        else cout<<temp+1-a<<" ";
        if(b==temp)
        cout<<temp+res-b<<" ";
        else cout<<temp+1-b<<" ";
        if(c==temp)
        cout<<temp+res-c<<"\n";
        else cout<<temp+1-c<<"\n";
    }
    return 0;
}

B

此文章已被阅读次数:正在加载...更新于