2 solutions

  • 1
    @ 2026-8-20 20:20:09
    #include<bits/stdc++.h>
    using namespace std;
    int main()
    {
    	int a,b;
    	cin>>a>>b;
    	int c=0;
    	for(int i=a+1;i<b;i++)//从a+1到b-1循环 
    	{
    		if((i%4==0 and i%100!=0)or i%400==0)
    		{
    			c+=i;
    		}
    	}
    	cout<<c;
        return 0;
    }
    
    • 0
      @ 2026-8-6 16:14:01
      #include<bits/stdc++.h>
      using namespace std;
      int main()
      {
          int a,b;
          cin>>a>>b;
      	int s=0;
      	for(int i=(a+1);i<b;i++)
      	{
      		if(i%4==0&&i%100!=0||i%400==0)
      		{
      			s=s+i;
      		}
      	}
      	cout<<s;
      	return 0;
      }
      
      • 1

      Information

      ID
      1155
      Time
      1000ms
      Memory
      256MiB
      Difficulty
      1
      Tags
      (None)
      # Submissions
      249
      Accepted
      50
      Uploaded By