2 条题解

  • 0
    @ 2025-4-17 17:33:16
    #include<bits/stdc++.h>
    using namespace std;
    int main()
    {
    	int x,y;
    	cin>>x>>y;
    	cout<<(x*4-y)/2<<' '<<x-(x*4-y)/2;
    	return 0;
    }
    
    • 0
      @ 2024-12-24 9:14:29

      C++ :

      #include<bits/stdc++.h>
      using namespace std;
      int main()
      {
      	int h,f,c,r;
      	cin>>h>>f;
      	for(c=1;c<=h;c++)
      	{
      		r=h-c;
      		if(r*4+c*2==f)
      		{
      			cout<<c<<' '<<r;
      			break;
      		}
      	}
      	return 0;
      }
      

      Python :

      # coding=utf-8
      x,y=input().split()
      x=int(x)
      y=int(y)
      tu=0
      while tu<x:
          ji=x-tu
          if ji*2+tu*4 == y:
              print(ji,tu)
          tu=tu+1
      
      • 1

      信息

      ID
      454
      时间
      1000ms
      内存
      128MiB
      难度
      10
      标签
      递交数
      2
      已通过
      1
      上传者