1 条题解

  • 0
    @ 2025-8-24 21:30:19

    自动搬运

    查看原文

    来自洛谷,原作者为

    avatar enceladus

    搬运于2025-08-24 21:30:19,当前版本为作者最后更新于2018-09-01 15:12:43,作者可能在搬运后再次修改,您可在原文处查看最新版

    自动搬运只会搬运当前题目点赞数最高的题解,您可前往洛谷题解查看更多

    以下是正文


    安利博客

    小伙伴做题时会对题意不理解吗?

    我先解释一下题意。

    连击最多只能打两下。概率是没有用的。这里直接算就行。


    先用“||”判断数据有没有锅


    再用连击两下和boss比较

    (z<<1)<=>x
    

    看看可以不可以杀死

    输出

    Yes或No


    再用x和z比较

    z<=>x
    

    一下死就直接计算即可。

    if(z>x)
    		{
    			if(int(z*0.33)+y>=315){
    				cout<<"Great"<<endl;
    			}
    			else if(int(z*0.5)+y>=315){
    				cout<<"Eh.."<<endl<<"OK"<<endl;
    			}
    			else if(int(z+y>=315){
    				cout<<"Oh.."<<endl<<"Oh.."<<endl<<"Yes , If he can get 5-star."<<endl;
    			}
    			else {
    				cout<<"No"<<endl<<"No"<<endl<<"No"<<endl;
    			}
    		}
    

    两下就乘2。

    {
    			if(2*int(z*0.33)+y>=315){
    				cout<<"Great"<<endl;
    			}
    			else if(2*int(z*0.5)+y>=315){
    				cout<<"Eh.."<<endl<<"OK"<<endl;
    			}
    			else if(2*z+y>=315){
    				cout<<"Oh.."<<endl<<"Oh.."<<endl<<"Yes , If he can get 5-star."<<endl;
    			}
    			else {
    				cout<<"No"<<endl<<"No"<<endl<<"No"<<endl;
    			}
    

    注意换行。

    计算时要强制转int

    全篇的if/else判断即可

    代码有锅 勿抄。QuQ.

    #include<iostream>
    #include<cstdio>
    #include<algorithm>
    #define INF 0x7fffffff
    #define ll long long
    #define IL inline
    #define R register
    using namespace std;
    int x,y,z;
    
    int main()
    {
       cin>>x>>y>>z; 
       if(y<=0||y>315||y>=x||x>1800||z>=1000||z<=100)
       {
       	cout<<"Wrong Data"<<endl;
       	//exit(0);结束
       	return 0; 
       }
       if((z<<1)<=x)
       {
       	cout<<"Yes"<<endl;
       	return 0;
       }
       else {
       	cout<<"No"<<endl;
       	if(z>x)
       	{
       		if(int(z*0.33)+y>=315){
       			cout<<"Great"<<endl;
       		}
       		else if(int(z*0.5)+y>=315){
       			cout<<"Eh.."<<endl<<"OK"<<endl;
       		}
       		else if(int(z+y>=315){
       			cout<<"Oh.."<<endl<<"Oh.."<<endl<<"Yes , If he can get 5-star."<<endl;
       		}
       		else {
       			cout<<"No"<<endl<<"No"<<endl<<"No"<<endl;
       		}
       	}
       	else {
       		if(2*int(z*0.33)+y>=315){
       			cout<<"Great"<<endl;
       		}
       		else if(2*int(z*0.5)+y>=315){
       			cout<<"Eh.."<<endl<<"OK"<<endl;
       		}
       		else if(2*z+y>=315){
       			cout<<"Oh.."<<endl<<"Oh.."<<endl<<"Yes , If he can get 5-star."<<endl;
       		}
       		else {
       			cout<<"No"<<endl<<"No"<<endl<<"No"<<endl;
       		}
       	}
       }
       return 0;
    }
    
    

    by enceladus 不要变棕QwQ

    • 1

    信息

    ID
    758
    时间
    1000ms
    内存
    125MiB
    难度
    2
    标签
    递交数
    0
    已通过
    0
    上传者