1 条题解

  • 0
    @ 2025-10-10 19:32:49

    C++ :

    #include<bits/stdc++.h>
    using namespace std;
    int main() {
    	int m,n;
    	cin>>m>>n;
    	int c = 0;
    	for(int i = m;i <= n;i++){
    		if(i % 6 == 0 || i % 8 == 0){
    			c++;
    		}
    	}
    	cout<<c;
    	return 0;
    }
    

    Python :

    m,n=map(int,input().split())
    s=0
    for i in range(m,n+1):
        if i%6==0 or i%8==0:
            s=s+1
    print(s)
    
    • 1

    信息

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