为什么我错了,哪位大佬帮忙看看?

lyh098 仙辞 2023-12-15 19:05:34 10

#include <bits/stdc++.h>

using namespace std;

int rn(int n) { if (n % 4 == 0) { if (n % 100 == 0) { if (n % 400 == 0) { return 1; } else return 0; } else return 1; } else return 0; } #include <bits/stdc++.h>

using namespace std; #include <bits/stdc++.h>

using namespace std;

int rn(int n) { if (n % 4 == 0) { if (n % 100 == 0) { if (n % 400 == 0) { return 1; } else return 0; } else return 1; } else return 0; } int main() { int n, m; cin >> n >> m; if (rn(n) == 0) { 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; case 2: cout << "28"; break; } } else { 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; case 2: cout << "29"; break; } } return 0; } v int rn(int n) { if (n % 4 == 0) { if (n % 100 == 0) { if (n % 400 == 0) { return 1; } else return 0; } else return 1; } else return 0; } int main() { int n, m; cin >> n >> m; if (rn(n) == 0) { 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; case 2: cout << "28"; break; } } else { 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; case 2: cout << "29"; break; } } return 0; { int n, m; cin >> n >> m; if (rn(n) == 0) { 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; case 2: cout << "28"; break; } } else { 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; case 2: cout << "29"; break; } } return 0; }

{{ vote && vote.total.up }}

共 12 条回复

lyh098 仙辞
lyh098 仙辞