1 条题解

  • 0
    @ 2025-10-10 15:45:59

    C :

    
    #include<stdio.h>
    int main()
    {
        int i;
        for(i=1;i<5;i++)
        {
            if(((40-8*i)%3==0)&&((40-8*i)>=3))
                printf("%d %d",i,(40-8*i)/3);
        }
        return 0;
    }
    
    

    C++ :

    #include <iostream>
    using namespace std;
    int main()
    {
    	int i,j;
    	for(i = 1; i < 44 / 8; i++)
    	{
    		j = (44 - i * 8) / 3;
    		if(i * 8 + 3 * j == 44 && j >= 1 && (44 - i * 8) % 3 == 0)
    		{
    			cout<<i<<" "<<j<<endl;
    		}
    	}
    	return 0;
    }
    

    Java :

    import java.util.Scanner;
    public class Main
    {
    	public static void main(String[] args){
    		Scanner sc=new Scanner(System.in);
    		for (int i=1;i<=(44-3)/8 ;i++ )
    		{
    			if ((44-8*i)%3==0)
    			{
    				System.out.println(i+" "+(44-8*i)/3);
    			}
    		}
    	}
    }
    

    Python :

    print("2 8");
    
    • 1

    信息

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