1 条题解

  • 0
    @ 2024-6-20 21:46:55

    我们发现当 x>n2x>\lfloor\frac n2\rfloor 时你找不到两个合法的 y,zy,z。当 x=n2x=\lfloor\frac n2\rfloor 可以找到 y=n2,z=2yy=\lfloor\frac n2\rfloor,z=2y。所以这个 xx 就是答案。

    你以为这就满分了吗?注意到可能有多个 y,zy,zxx 的倍数。当 nn 是偶数显然恰有两个 y,zy,z,当 nn 为奇数考虑 n3n2=3(n1)2n\ge3\lfloor\frac n2\rfloor=\frac{3(n-1)}{2}n3n\le 3。发现 n=3n=3 时实际有 y=2,z=3y=2,z=3。特判即可。

    下面给出 spj 实现:

    int n,s;
    n=inf.readInt();s=inf.readInt();
    int a=n/2,b=n/2,c=n/2*2;
    if(n==3)b=2,c=3;
    int A=ouf.readInt(),B=ouf.readInt(),C=ouf.readInt();
    if(s<=1){
    	if(A==0&&B==0&&C==0){
    		if(s==1)quitp(0.520,"Sadly, you lost the game.");
    		else quitp(0.8,"A draw! You're strong enough to be an administrator, but cyx may not allow it.");
    	}
    }
    if(B<1||C<1||B>=C||C>n)quitf(_wa,"Ridiculous game!");
    if(A==a&&B==b&&C==c)quitf(_ok,"You have won, and you have perfectly won");
    if(A==a)quitp(0.9,"You are close to a perfect win, but still a little bit further! However, who told you to win the game? Do you think he'll really give out his girlfriend?");
    if(s>A)quitp(0.520,"Sadly, you lost the game.");
    if(s==A)quitp(0.8,"A draw! You're strong enough to be an administrator, but cyx may not allow it.");
    if(s<A)quitp(0.1314,"Who told you to win the game? Do you think he'll really give out his girlfriend?");
    
    
    

    信息

    ID
    984
    时间
    1000ms
    内存
    256MiB
    难度
    1
    标签
    (无)
    递交数
    39
    已通过
    5
    上传者