7 条题解

  • 2
    @ 2023-12-23 14:32:15
    #include<iostream>
    using  namespace std;
    int main(){
    	int y,m;
    	cin>>y>>m;
    	if(m==1) cout<<31;
    	if(m==2){
    	    if(y%4==0 and y%100!=0 or y%400==0)
    		cout<<29;
    	else
    		cout<<28;
        }
        if(m==3) cout<<31;
        if(m==4) cout<<30;
        if(m==5) cout<<31;
        if(m==6) cout<<30;
        if(m==7) cout<<31;
        if(m==8) cout<<31;
        if(m==9) cout<<30;
        if(m==10) cout<<31;
        if(m==11) cout<<30;
        if(m==12) cout<<31;
    	return 0;
    }
    
    • -1
      @ 2024-3-2 17:52:56

      #include <bits/stdc++.h> using namespace std; int main() { int y,m,d; cin>>y>>m; if(m1 or m3 or m5 or m7 or m8 or m10 or m12) { d=31; } else if(m4 or m6 or m9 or m11) { d=30; } else if(m2) { if(y%40&&y%100!=0||y%4000) { d=29; } else { d=28; } } else { d=0; } cout<<d; return 0; }

      • -1
        @ 2024-2-23 10:38:55

        #include <bits/stdc++.h> using namespace std; int main() { int y,m; cin>>y>>m; if(m2) if((y%40&&y%100!=0)||y%400==0)cout<<"29"; else cout<<"28"; switch(m) {case 1: case 3: case 5: case 7: case 8: case 10: case 12: cout<<"31";break; case 4: case 6: case 9: case 11:cout<<"30";break; }

        return 0;
        

        }

        • -1
          @ 2024-2-23 10:31:38

          #include <bits/stdc++.h> using namespace std; int main() { int y,m; cin>>y>>m; if(m2) if((y%40&&y%100!=0)||y%400==0)cout<<"29"; else cout<<"28"; switch(m) {case 1: case 3: case 5: case 7: case 8: case 10: case 12: cout<<"31";break; case 4: case 6: case 9: case 11:cout<<"30";break; }

          return 0;
          

          }

          • -1
            @ 2024-2-23 9:43:19

            #include using namespace std; int main(){ int y,m; cin>>y>>m; if(m1) cout<<31; if(m2){ if(y%40 and y%100!=0 or y%4000) cout<<29; else cout<<28; } if(m3) cout<<31; if(m4) cout<<30; if(m5) cout<<31; if(m6) cout<<30; if(m7) cout<<31; if(m8) cout<<31; if(m9) cout<<30; if(m10) cout<<31; if(m11) cout<<30; if(m12) cout<<31; return 0; }

            • -1
              @ 2024-2-22 10:49:49
              #include<bits/stdc++.h>
              using namespace std;
              int main(){ 
                  int x,y,n,r; 
                  cin>>x>>y; 
                  if((x%4==0 && x%100==!0) or (x%400==0)) 
                  x=n;
                  else
                   x=r;
                  if (x==n and y==2) cout<<29;
                  else
                   if (x==n and y==!2) 
                   cout<<28;
                   else
                   if(y==1 or y==3 or y==5 or y==7 or y==8 or y==10 or y==12)cout<<31;
                   else
                    cout<<30;
              
                 return 0; }
              
              
              • 1

              信息

              ID
              821
              时间
              1000ms
              内存
              64MiB
              难度
              2
              标签
              递交数
              309
              已通过
              190
              上传者