国13-12345

#include <bits/stdc++.h>

using namespace std;

typedef long long int ll;
typedef unsigned long long ull;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<ii> vii;
typedef vector<vi> vvi;
typedef vector<bool> vb;



#define lowbit(S) ((S) & -(S))
#define sz(x) ((int)(x.size()))
#define bitcount __builtin_popcount



#define pb push_back
#define bg begin()
#define ed end()
#define rbg rbegin()
#define red rend()






        //13届国赛题目

//A 小蓝与钥匙

void buleAndkeys(int n = 28){
    ll result = 0;
    vll f(n + 1);
    f[2] = 1, f[3] = 2;
    for (int i = 4; i <= 14; ++i)
        f[i] = (i - 1) * (f[i - 1] + f[i - 2]);
    for (int i = 1; i < (1 << 28); ++i){
        if (bitcount(i) == 14){
            result += f[14];
        }
    }
    cout << result << endl;
}




//C 近似GCD

void emuGCD(){
    int n, g; cin >> n >> g;
    vi a(n + 1);
    for (int i = 1; i <= n; ++i) cin >> a[i];
    int lastmdf = 0, start = 1;
    ull result = 0;
    for (int i = 1; i <= n; ++i) {
        if (a[i] % g != 0){
            if (lastmdf == 0) lastmdf = i;
            else{
                start = lastmdf + 1;
                lastmdf = i;
            }
        }
        result += i - start;
    }
    cout << result << endl;
}




//D 交通信号

struct noded{
    int vex, r, g, d;
    bool b;
};
void trafficS(){
    int n, m, s, t;
    cin >> n >> m >> s >> t;
    vector<vector<noded>> al(n + 1);
    for (int i = 0; i < m; ++i){
        int u, v, r, g, d; cin >> u >> v >> g >> r >> d;
        al[u].pb({v, g, r, d, true});
        al[v].pb({u, g, r, d, false});
    }
    queue<pair<int, ll>> q;
    q.push({s, ll(0)});
    ll result = 1e9;
    vb bs(n + 10, false);   bs[s] = 1;
    while (!q.empty()){
        int u = q.front().first; ll time = q.front().second; q.pop();
        if (u == t){result = min(result, time);}
        for (auto& x : al[u]){if (bs[x.vex] == 1) continue;bs[x.vex] = 1;
            int sum = x.r + x.g + x.d * 2;
            int t = time % sum;
            ll arrtime = time + x.d;
            if (x.b == true){
                if (t > x.g){arrtime += sum - t;}
            }
            else{
                if (t < x.g + x.d || t >= x.g + x.d + x.r){arrtime += sum - t + x.g + x.d;}
            }
            q.push({x.vex, arrtime});
        }
    }
    cout << result << endl;
}


// 六iu大顺
void sum(string& a, string& b){
    int t = 0, rem = 0;
    int i, j;
    for (i = sz(b) - 1, j = sz(a) - 1; i >= 0; --i, --j){
        t = a[j] + b[i] - '0' - '0' + rem;
        a[j] = t % 10 + '0';
        rem = t / 10;
    }
    while (rem != 0){
        t = a[j] + rem - '0';
        a[j] = t % 10 + '0';
        rem = t / 10;
        --j;
    }
}
void print(string& s){
    for (int i = 0; i < sz(s); ++i){
        if (s[i] == '0') continue;
        else{
            cout << string(s.bg + i, s.ed) << endl;
            return;
        }
    }
}
void six(){
    int n; cin >> n;
    string result(1e7, '0');
    string num = "36";
    for (int i = 1; i <= n; ++i){
        sum(result, num);//cout << num << endl;print(result);
        num.insert(num.bg, '4');
        num.insert(num.ed - 1, '5');
    }
    print(result);

    //第n项 n - 1个4, 1个3, n - 1个5, 1个6. 从第二项开始.

}









//F owo
ull cnt_owo(const vector<string>& vs){
    char fir, sec;
    fir = vs[0][0];
    int starti, startj;
    ull cnt = 0;
    if (sz(vs[0]) > 1) {sec = vs[0][1]; starti = 0, startj = 2;}
    else if(sz(vs) > 1){sec = vs[1][0]; starti = 1; startj = 1;}
    for (int i = starti; i < sz(vs); ++i){
        for (int j = i == starti ? startj : 0; j < sz(vs[i]); ++j){
            if (vs[i][j] == 'o' && sec == 'w' && fir == 'o'){
                cnt += 1;
            }
            fir = sec, sec = vs[i][j];
        }
    }
    return cnt;
}
void owo(){
    int n; cin >> n;vector<string> vs;
    for (int i = 0; i < n; ++i){
        string s; cin >> s; vs.pb(s);
        ull result = 0;
        sort(vs.bg,vs.ed);
        do{
            result = max(result, cnt_owo(vs));
        } while(next_permutation(vs.bg, vs.ed));
        cout <<result << endl;
    }
}






int main(){
    ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);


    

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值