1 条题解

  • 1
    @ 2024-1-29 10:26:07

    这题真的是水题了 (不会有人要看题解吧)

    唯一一个难点就是他的号码和中奖号码不是对称的 这就要我们用双重循环来枚举判断他中了多少个红球和蓝球

    最后就是判断

    也是大水好吧

    #include<bits/stdc++.h>//完美的开始
    using namespace std;
    int main()//主函数
    {
    	long long a[10],ans[10],r=0,b=0;
    	for(long long i=1;i<=7;i++)
    		cin>>a[i];
    	for(long long i=1;i<=7;i++)
    		cin>>ans[i];
    	for(long long i=1;i<=5;i++)//判断中了多少个红球
    		for(int j=1;j<=5;j++)
    			if(a[i]==ans[j])
    			{
    				r++;
    				break;
    			}
    	for(long long i=6;i<=7;i++)//判断中了多少个篮球
    		for(int j=6;j<=7;j++)
    			if(a[i]==ans[j])
    			{
    				b++;
    				break;
    			}
    //判断
    	if(r==5&&b==2)
    	{
    		cout<<5000000;
    		return 0;
    	}
    	if(r==5&&b==1)
    	{
    		cout<<250000;
    		return 0;
    	}
    	if(r==5&&b==0)
    	{
    		cout<<3000;
    		return 0;
    	}
    	if(r==4&&b==2)
    	{
    		cout<<3000;
    		return 0;
    	}
    	if(r==4&&b==1)
    	{
    		cout<<200;
    		return 0;
    	}
    	if(r==3&&b==2)
    	{
    		cout<<200;
    		return 0;
    	}
    	if(r==4&&b==0)
    	{
    		cout<<10;
    		return 0;
    	}
    	if(r==3&&b==1)
    	{
    		cout<<10;
    		return 0;
    	}
    	if(r==2&&b==2)
    	{
    		cout<<10;
    		return 0;
    	}
    	if(r==3&&b==0)
    	{
    		cout<<5;
    		return 0;
    	}
    	if(r==1&&b==2)
    	{
    		cout<<5;
    		return 0;
    	}
    	if(r==2&&b==1)
    	{
    		cout<<5;
    		return 0;
    	}
    	if(r==0&&b==2)
    	{
    		cout<<5;
    		return 0;
    	}
    	cout<<0;//完美的输出
    	return 0;//华丽的结束
    }
    

    绝对正确(不对你打我)

    • 1

    信息

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