4 solutions

  • 1
    @ 2026-8-14 11:47:09

    自创方法,比季总的简单不止一万倍!点赞的是彭于晏

    #include<bits/stdc++.h>
    using namespace std;
    int main()
    {
        int M,D,y,m,d;
    	cin>>M>>D>>y>>m>>d;
    	if(m+d==M+D){
    		cout<<y+1<<" "<<1<<" "<<1;
    	}
    	else if(d==D){
    		cout<<y<<" "<<m+1<<" "<<1;
    	} 
    	else
    	{
    		cout<<y<<" "<<m<<" "<<d+1;
    	}
        return 0;
    }
    
    • -1
      @ 2026-8-9 21:41:34
      #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-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
          227
          Accepted
          76
          Uploaded By