3 条题解

  • 2
    @ 2023-10-14 19:28:40

    先赞后搬

    #include<bits/stdc++.h>
    using namespace std;
    int n,x,y;
    int main()
    {
        cin>>n>>x>>y;
        for(int i=1;i<=n/x;i++)
        {
            for(int j=1;j<=n/y;j++)
            {
                if(i+j>50&&i*x+j*y==n)
                {
                    cout<<i<<" "<<j<<endl;
                }
            }
        }
        return 0;
    }
    
    • 1
      @ 2024-1-14 11:51:33
      ``
      
      

      中于用python解出来了!!!!

      a = [int(i) for i in input().split()]
      n = a[0]
      x = a[1]
      y = a[2]
      xi = n / x
      yi = n / y
      xi= int(xi)
      yi = int(yi)
      for i in range(xi):
          for j in range(yi):
        
              if i + j > 50 and i * x + y * j == n:
                  if i != 0 and j != 0:
                      print(i,j)
      
      • 0
        @ 2023-1-17 15:41:52
        #include<bits/stdc++.h>
        using namespace std;
        int main()
        {
        	int n, x, y, t;
        	cin >> n >> x >> y;
        	//枚举篮球的购买范围
        	for(int i = 1; i <= (n - y) / x; i++){
        		//计算剩余的钱
        		t = n - i * x;
        		if(t % y == 0 && i + t / y > 50){
        			cout << i << " " << t / y << endl;
        		} 
        	} 
        	return 0;
        }
        
        
        • 1

        信息

        ID
        393
        时间
        1000ms
        内存
        16MiB
        难度
        1
        标签
        递交数
        48
        已通过
        34
        上传者