4 条题解

  • 0
    @ 2024-12-29 10:50:38
    #include<bits/stdc++.h>
    using namespace std;
    signed main(){
    	int n,m;
    	cin>>n>>m;
    	cout<<(4*n-m)/2<<' '<<(m-2*n)/2;
    }
    
    • 0
      @ 2024-12-29 8:40:19

      直接当个数学题干:

      #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-29 8:37:54

        第一次交写反了。

        #include<bits/stdc++.h>
        #define int long long
        #define INF 0x3f3f3f
        using namespace std;
        int x,y;
        signed main(){
        	cin>>x>>y;
        	cout<<x-y/2+x<<" "<<y/2-x;
        	return 0;
        }
        
        • 0
          @ 2024-12-22 11:03:54

          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
          41
          时间
          1000ms
          内存
          128MiB
          难度
          3
          标签
          递交数
          28
          已通过
          19
          上传者