1 条题解

  • 0
    @ 2025-8-3 15:57:49

    $O(max{x,y})

    发出牌的数量 sum: sum = 54 * n - x - y

    发牌的数量一定是人数的倍数,找到所有符合条件的结果即可。

    #include<bits/stdc++.h>
    using namespace std;
    int main(){
        int t;
        cin>>t;
        int n,x,y;
        while(t--){
            cin>>n>>x>>y;
            int sum=n*54-x-y;
            int z=0;
            for(int i=max(2,max(x,y)+1);i<=n*54;i++){
                if(sum%i==0){
                    cout<<i<<" ";
                    z=1;
                }
            }
            if(z==0) cout<<-1;
            
            cout<<endl;
        }
        return 0;
    }
    
    • 1

    信息

    ID
    476
    时间
    1000ms
    内存
    256MiB
    难度
    9
    标签
    递交数
    18
    已通过
    3
    上传者