1 条题解

  • 0
    @ 2025-4-12 22:06:18

    C++ :

    #include<bits/stdc++.h>
    using namespace std;
    int a,b,t;
    int main()
    {
        cin>>a>>b;
        for(int i=a;i<=b;i++)
        {
        	if(i%5==0&&i%6==0)
        	{
        		t++;
        		cout<<i<<" ";
        		if(t==10)cout<<"\n",t=0;
    		}
    	}
        return 0;
    }
    

    Java :

    import java.util.Scanner;
    
    public class Main {
    
    	public static void main(String[] args) {
    		// TODO 自动生成的方法存根
    		Scanner input=new Scanner(System.in);
    		int a=input.nextInt();
    		int b=input.nextInt();
    		int i=1;
    		while(a<b){
    			if(a%5==0 && a%6==0){
    				if(i<10){
    					System.out.print(a+" ");
    					i=i+1;
    				}
    				else{
    					System.out.print(a+"\n");
    					i=1;
    				}
    			}
    			a=a+1;
    		}
    	}
    
    }
    
    
    • 1

    信息

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