2 solutions

  • 0
    @ 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; //天数归1
    		m++; //月份增加
    	}
    	if(m>M) //超过了年份的最大月份
    	{
    		m=1; //月份归1
    		y++; //年份增加
    	}
    	cout<<y<<" "<<m<<" "<<d; 
    	return 0;
    }
    
    
    • -4
      @ 2025-6-14 9:16:37

      #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

      Information

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