2 solutions

  • 1
    @ 2025-4-26 16:08:45
    #include<bits/stdc++.h>
    using namespace std;
    int main()
    {
    	int M,D,y,m,d;
    	cin>>M>>D>>y>>m>>d;
    	d++;
    	if(d>D)
    	{
    		d=1;
    		m++;
    	}
    	if(m>M)
    	{
    		m=1;
    		y++;
    	}
    	cout<<y<<" "<<m<<" "<<d; 
    	return 0;
    }
    
    
    • 1
      @ 2025-3-29 10:43:49
      #include<bits/stdc++.h>
      using namespace std;
      int main()
      {
      	int M,D,y,m,d;
      	cin>>M>>D;
      	cin>>y>>m>>d;
      	if(d+1>D&&m+1<=M)
      	{
      		d=1;
      		m=m+1;
      		cout<<y<<" "<<m<<" "<<d;
      	}
      	else if(d+1>D&&m+1>M)
      	{
      		y=y+1;
      		m=1;
      		d=1;
      		cout<<y<<" "<<m<<" "<<d;
      	}
      	else if(d+1<=D)
      	{
      		d=d+1;
      		cout<<y<<" "<<m<<" "<<d;
      	}
      
      	return 0;
      }
      
      • 1

      Information

      ID
      2323
      Time
      1000ms
      Memory
      256MiB
      Difficulty
      1
      Tags
      (None)
      # Submissions
      58
      Accepted
      22
      Uploaded By