1 条题解

  • 0
    @ 2023-6-29 15:27:59
    #include<bits/stdc++.h>
    using namespace std;
    int main()
    {
    	int head,foot;
    	cin>>head>>foot;
    	for(int i=1;i<=head;i++)
    		for(int j=1;j<=head;j++){
    			if(i+j==head&&i*2+j*4==foot)
    			{
    				cout<<i<<" "<<j<<"\n";
    				break;
    			}
    		}
    	return 0;
    }
    
    #include<bits/stdc++.h>
    using namespace std;
    int main()
    {
    	int head,foot;
    	cin>>head>>foot;
    	for(int i=1;i<=head;i++)
    	{
    		int j=head-i; 
    		if(i*2+j*4==foot)
    		{
    			cout<<i<<" "<<j<<"\n";
    			break;
    		}
    	}
    	return 0;
    }
    
    #include<bits/stdc++.h>
    using namespace std;
    int main()
    {
    	int head,foot;
    	cin>>head>>foot;
    	int j=foot/2-head;//兔 
    	int i=head-j;//鸡
    	cout<<i<<" "<<j<<"\n";
    	return 0;
    }
    
    • 1

    信息

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