1 条题解

  • 0
    @ 2025-4-7 21:41:58

    C++ :

    #include<iostream>
    #include<cstring>
    #include<cstdio>
    #include<cmath>
    using namespace std;
    int main()
    {
    	int s,b,tot=0;
    	cin>>s>>b;
    	for(int i=s;i<=b;++i)
        {
        	if(i%6==0||i%8==0)
        	++tot;
        }
        cout<<tot;
        return 0;
    }
    

    Pascal :

    program y2;
     var a,b,i,j,js:integer;
     begin
      readln(a,b);
      js:=0;
      for i:=a to b do
       begin
        if (i mod 6)=0
         then js:=js+1;
        if (i mod 8)=0
         then js:=js+1;
        if (i mod 6) or (i mod 8)=0
         then js:=js-1;
       end;
      writeln(js);
     end.
    
    
    • 1

    信息

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