2 条题解

  • 3
    @ 2023-10-14 14:27:02
    #include<iostream> 
    #include<cstdio> 
    #include<cmath> 
    #include<algorithm> 
    #include<cstring> 
    #include<string> 
    using namespace std;
    int main(){
    	int y,m;
    	cin >> y >> m;
    	bool run;//闰年
    	if(y%4 == 0) {
    		if(y%100==0){
    			if(y%400 == 0){
    				run = 1;
    			}else{
    				run = 0;
    			}
    		}else{
    			run = 1;
    		}
    	}
    	if(m == 1||m == 3||m == 5||m == 7||m == 8||m == 10||m == 12){
    		cout << 31;
    	}
    	if(m == 4||m == 6||m == 9||m == 11){
    		cout << 30;
    	}
    	if(m == 2){
    		if(run == 1){
    			cout << 29;
    		}else{
    			cout << 28;
    		}
    	}
    	return 0;
    }
    
    • 0
      @ 2023-10-22 12:50:47

      有壮壮,好评

      #include <bits/stdc++.h>
      using namespace std;
      int main()
      {
          int n,b;
          cin>>n>>b;
          if (b == 1 || b == 3 || b == 5 || b == 7 || b == 8 || b == 10 || b == 12)
          {
              cout<<31;
          }
          if (b == 4 || b == 6 || b == 9 || b == 11)
          {
              cout<<30;
          }
          if (b == 2)
          {
              if (n % 100 == 0)
              {
                  if (n % 400 == 0)
                  {
                      cout<<29;
                  }
                  else
                  {
                      cout<<28;
                  }
              }
              else if (n % 4 == 0)
              {
                  cout<<29;
              }
              else
              {
                  cout<<28;
              }
          }
          return 0;
      }
      
      • 1

      信息

      ID
      4638
      时间
      1000ms
      内存
      125MiB
      难度
      1
      标签
      (无)
      递交数
      18
      已通过
      14
      上传者