zoukankan      html  css  js  c++  java
  • Namomo Namomo Cockfight Round 3

    太难了

    A

    接着A题漏判好多, 真不如枚举简单
    看代码吧, 一般是漏情况wa

    #include <bits/stdc++.h>
    #define all(n) (n).begin(), (n).end()
    #define se second
    #define fi first
    #define pb push_back
    #define mp make_pair
    #define sqr(n) (n)*(n)
    #define rep(i,a,b) for(int i=(a);i<=(b);++i)
    #define per(i,a,b) for(int i=(a);i>=(b);--i)
    #define IO ios::sync_with_stdio(0); cin.tie(0)
    using namespace std;
    typedef long long ll;
    typedef pair<int, int> PII;
    typedef pair<ll, ll> PLL;
    typedef vector<int> VI;
    typedef double db;
    
    const int N = 1e5 + 5;
    
    int n, m, _, k, t;
    
    int main() {
        IO;
        cin >> n;
        string s; cin >> s;
    
        if (n == 4 || n == 3) {
            if (s == "NN") cout << "Impossible";
            else if (n == 4) cout << 'N';
            else if (n == 3) cout << 'Y';
        } else {
            if (s == "YY") cout << "Impossible";
            else cout <<  'Y';
        } 
        return 0;
    }
    

    B

    先说无限刷命
    t == 1, 显然

    其他情况, 无非是跳完 k 之后能返回, 低 k - d 个

    说白了就是跳个圈

    1 9 2 8 3 7 4 6 5

    发现没有隔一个跳一个

    只要最大的循环圈大于 cd 即可

    没有圈按顺序跳一个算一个

    #include <bits/stdc++.h>
    #define all(n) (n).begin(), (n).end()
    #define se second
    #define fi first
    #define pb push_back
    #define mp make_pair
    #define sqr(n) (n)*(n)
    #define rep(i,a,b) for(int i=a;i<=(b);++i)
    #define per(i,a,b) for(int i=a;i>=(b);--i)
    #define IO ios::sync_with_stdio(0); cin.tie(0);
    using namespace std;
    typedef long long ll;
    typedef pair<int, int> PII;
    typedef pair<ll, ll> PLL;
    typedef vector<int> VI;
    typedef double db;
    
    const int N = 2e5 + 5;
    
    int n, m, _, k;
    ll a[N];
    int d[N] = {1, 1};
    
    int main() {
        ios::sync_with_stdio(0); cin.tie(0);
        for (cin >> _; _; --_) {
            cin >> n >> m >> k >> a[1];
            rep (i, 2, n) {
                cin >> a[i];
                d[i] = 1 + (a[i] - a[i - 1] <= m);
            }
    
            int mx = n - 1 ? d[2] : 1;
            rep (i, 3, n)  {
                if (a[i] - a[i - 2] <= m) d[i] = d[i - 1] + 1;
                mx = max(mx, d[i]);
            }
    
            if (mx >= k) { cout << "niao!
    "; continue; }
    
            mx = 1;
            rep (i, 2, n)
                if (a[i] - a[i - 1] <= m) d[i] = d[i - 1] + 1;
                else mx = max(mx, d[i - 1]), d[i] = 1;
            
            cout << max(mx, d[n]) << '
    ';
        }
        return 0;
    }
    
  • 相关阅读:
    强类型DataSet (2011-12-30 23:16:59)转载▼ 标签: 杂谈 分类: Asp.Net练习笔记 http://blog.sina.com.cn/s/blog_9d90c4140101214w.html
    整合91平台接入的ANE
    keychain不能导出p12证书的解决方法
    制作IOS ANE的基本流程
    SVN 提交失败 非LF行结束符
    ANE打包工具使用视频教程 -- 梦宇技术 @极客学院
    RSA算法原理
    IOS 之 NSBundle 使用
    iOS编程——Objective-C KVO/KVC机制
    视图横竖屏控制技巧
  • 原文地址:https://www.cnblogs.com/2aptx4869/p/13340820.html
Copyright © 2011-2022 走看看