2 solutions

  • -2
    @ 2025-8-26 14:43:54
    using namespace std;
    int main(){
    	//freopen("day.in","r",stdin);
    	//freopen("day.out","r",stdout);
    	int a,b,c,s=0;
    	cin>>a>>b>>c;
    	for(int i=1;i<=b;i++){
    		if(i!=2){
    			if(i==4||i==6||i==9||i==11){
    				s+=30;
    			}
    			else{
    				s+=31;
    			}
    		}
    		else{
    			if(a%4==0&&a%100!=0||a%400==0){
    				s+=29;
    			}
    			else{
    				s+=28;
    		}
    	}
        } 
    	if(b!=2){
    		if(b==4||b==6||b==9||b==11){
    			s-=30-c;
    		}
    		else{
    			s-=31-c;
    		}
    	}
    	else{
    		if(a%4==0&&a%100!=0||a%400==0){
    			s-=29-c;
    		}
    		else{
    			s-=28-c;
    	    }
        }
        cout<<s;
        return 0;
    }
    
    

    Information

    ID
    1002
    Time
    1000ms
    Memory
    256MiB
    Difficulty
    8
    Tags
    # Submissions
    100
    Accepted
    14
    Uploaded By