1 条题解

  • 0
    @ 2025-10-8 16:54:52
    #include <bits/stdc++.h>
    using namespace std;
    int a[7];
    int main()
    {
        int n;
        scanf("%d", &n);
        memset(a, 0, sizeof(a));
        int s = 0;
        for (int i = 1900; i <= 1900 + n - 1; i++)
            for (int j = 1; j <= 12; j++)
            {
                a[(s + 13) % 7]++;
                if ((j == 4) || (j == 6) || (j == 9) || (j == 11))
                    s += 30;
                else if (j == 2)
                {
                    if ((i % 400 == 0) || ((i % 4 == 0) && (i % 100 != 0)))
                        s += 29;
                    else
                        s += 28;
                }
                else
                    s += 31;
            }
        printf("%d ", a[6]);
        for (int i = 0; i <= 5; i++)
            printf("%d ", a[i]);
        printf("\n");
        return 0;
    }
    
    • 1

    【模拟】周几天数[USACO1.1]Friday the Thirteenth

    信息

    ID
    981
    时间
    1000ms
    内存
    128MiB
    难度
    5
    标签
    递交数
    329
    已通过
    115
    上传者