2 solutions

  • 0
    @ 2026-3-1 15:26:30

    dshjsfjsgdfsdgfdasghfdg

    • 0
      @ 2026-3-1 15:23:08
      #include <bits/stdc++.h>
      using namespace std;
      
      int a[30] = {0, 3, 6, 6, 2, 4, 7, 2, 5, 1, 3, 6, 1};
      
      int b[30] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
      
      int main() {
      	int n;
      	cin >> n;
      	cout << "MON TUE WED THU FRI SAT SUN\n";
      	int s = a[n];
      	for (int i = 1; i <= a[n] * 4 - 2; i++)
      		cout << " ";
      	for (int i = 1; i <= b[n]; i++) {
      		if (i == 1)
      			cout << i << " ";
      		else
      			cout << setw(3) << i << " ";
      		if (s % 7 == 0)
      			cout << "\n";
      		s++;
      	}
      	return 0;
      }
      
      

      这题我们先用日历查出买个月第一天是星期几、有几天,再把固定格式(MON TUE WED THU FRI SAT SUN)输出,接着输出第一天之前的空格最后输出每个日期,日期输出除了我那样,还可以cout<<(i<10?" "/三个空格/:" "/两个空格/)<<i<<" "/一个空格/;。

    • 1

    Information

    ID
    19564
    Time
    1000ms
    Memory
    512MiB
    Difficulty
    3
    Tags
    # Submissions
    5
    Accepted
    2
    Uploaded By