1 条题解

  • 0
    @ 2025-8-4 16:36:38

    O(1) 模拟

    需要判断分别两个条件:传送门和魔力潮汐

    • 传送门:直接判断日期和月份是否符合条件
    • 魔力潮汐: 111111 日是周一,要判断现在的日期是周几,需要先求出两个日期相差的天数,从而再求周几。
    #include<bits/stdc++.h>
    
    using namespace std;
    
    typedef long long LL;
    typedef pair<LL, LL> PII;
    
    #define x first
    #define y second
    
    const int N = 2e5 + 10, M = 30;
    
    int a[N];
    
    void solve() 
    {
        int y, m, d;
        cin >> y >> m >> d;
        bool f1 = d % 7 == 0 && (m & 1);
        
        int div = (y - 1) * 13 * 28 + (m - 1) * 28 + d - 1;
        div %= 8;
        
        bool f2 = y % 4 == 0 && div == 5;
        if(f1 && f2)
            cout << "Both\n";
        else if(f1)
            cout << "Portal\n";
        else if(f2)
            cout << "Tide\n";
        else 
            cout << "None\n";
    }            
    
    int main()
    {
        ios::sync_with_stdio(0);
        cin.tie(0);
        int t = 1;
        // cin >> t;
        while(t --)
            solve();
    }
    
    • 1

    信息

    ID
    487
    时间
    1000ms
    内存
    256MiB
    难度
    8
    标签
    递交数
    19
    已通过
    5
    上传者