2023牛客寒假算法基础集训营4(10/13)

news2024/9/23 23:28:24

清楚姐姐学信息论

数学,只需要求x的y次方和y的x次方那个大选哪个,除了2和3时是3多,其他情况都是数越小能代表的数越多

AC代码:

#include <bits/stdc++.h>
using namespace std;
using LL = long long;
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int x, y;
    cin >> x >> y;
    int maxx = max(x, y), minn = min(x, y);
    if (maxx == 3 && minn == 2) {
        cout << 3 << '\n';
    } else {
        cout << minn << '\n';
    }
    return 0;
}

清楚姐姐学构造

通过同余方程式可以看出,a是关于中点对称的,b的绝对值是关于中点对称的

因为

c[i]=a[i]+b[i]

所以

c[i]+c[n-1-i]=2*a[i]

c[n-1-i]-c[i]=2*b[i]

有了上述计算公式,发现c[i]+c[n-1-i]和c[n-1-i]-c[i]必须都是偶数才行,因为模数m一定是质数,也可知的是质数除了2都是奇素数,因此,除了2一定存在若干个m可以把c[i]+c[n-1-i]和c[n-1-i]-c[i]变成偶数来得到a[i],b[i],但如果是2,则不可能,所以当m=2时如果存在奇数,则输出No

AC代码:

#include <bits/stdc++.h>
using namespace std;
using LL = long long;
#define int long long
signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n, m;
    cin >> n >> m;
    vector<int> x, y;
    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    if (n == 1) {
        cout << "Yes\n";
        cout << a[0] << '\n';
        cout << "0\n";
        return 0;
    }
    if (m == 2) {
        for (int i = 0; i < n / 2; i++) {
            if ((a[i] + a[n - 1 - i]) % 2 == 1) {
                cout << "No\n";
                return 0;
            }
            int p = (a[i] + a[n - 1 - i]) / 2;
            x.push_back(p % m);
            if (((a[n - 1 - i] - a[i] + m) % m) % 2 == 1) {
                cout << "No\n";
                return 0;
            }
            p = ((a[n - 1 - i] - a[i] + m) % m) / 2;
            y.push_back(p % m);
        }
        if (n & 1) {
            x.push_back(a[n / 2]);
            y.push_back(0);
            cout << "Yes\n";
            for (int i = 0; i <= n / 2; i++) {
                cout << x[i] << " ";
            }
            for (int i = n / 2 - 1; i >= 0; i--) {
                cout << x[i] << " \n"[i == 0];
            }
            for (int i = 0; i <= n / 2; i++) {
                cout << m - y[i] << " ";
            }
            for (int i = n / 2 - 1; i >= 0; i--) {
                cout << y[i] << " \n"[i == 0];
            }
        } else {
            cout << "Yes\n";
            for (int i = 0; i < n / 2; i++) {
                cout << x[i] << " ";
            }
            for (int i = n / 2 - 1; i >= 0; i--) {
                cout << x[i] << " \n"[i == 0];
            }
            for (int i = 0; i < n / 2; i++) {
                cout << m - y[i] << " ";
            }
            for (int i = n / 2 - 1; i >= 0; i--) {
                cout << y[i] << " \n"[i == 0];
            }
        }
        return 0;
    }
    if (n & 1) {
        for (int i = 0; i < n / 2; i++) {
            int p = (a[i] + a[n - 1 - i]);
            while (p & 1) {
                p += m;
            }
            x.push_back(p / 2 % m);
            p = (a[n - 1 - i] - a[i] + m) % m;
            while (p & 1) {
                p += m;
            }
            y.push_back(p / 2 % m);
        }
        x.push_back(a[n / 2]);
        y.push_back(0);
        cout << "Yes\n";
        for (int i = 0; i <= n / 2; i++) {
            cout << x[i] << " ";
        }
        for (int i = n / 2 - 1; i >= 0; i--) {
            cout << x[i] << " \n"[i == 0];
        }
        for (int i = 0; i <= n / 2; i++) {
            cout << m - y[i] << " ";
        }
        for (int i = n / 2 - 1; i >= 0; i--) {
            cout << y[i] << " \n"[i == 0];
        }
    } else {
        for (int i = 0; i < n / 2; i++) {
            int p = (a[i] + a[n - 1 - i]);
            while (p & 1) {
                p += m;
            }
            x.push_back(p / 2 % m);
            p = (a[n - 1 - i] - a[i] + m) % m;
            while (p & 1) {
                p += m;
            }
            y.push_back(p / 2 % m);
        }
        x.push_back(a[n / 2]);
        y.push_back(0);
        cout << "Yes\n";
        for (int i = 0; i < n / 2; i++) {
            cout << x[i] << " ";
        }
        for (int i = n / 2 - 1; i >= 0; i--) {
            cout << x[i] << " \n"[i == 0];
        }
        for (int i = 0; i < n / 2; i++) {
            cout << m - y[i] << " ";
        }
        for (int i = n / 2 - 1; i >= 0; i--) {
            cout << y[i] << " \n"[i == 0];
        }
    }
    return 0;
}

清楚姐姐学01背包(Easy Version)

01背包,因为数据范围比较小,可以n的3次方暴力通过,即在01背包的基础上多了一维枚举去掉的是哪一个蝴蝶结,即dp[i][j]表示的是去掉第i个蝴蝶结后的n-1个蝴蝶结中,体积为j的最大好看程度总和

AC代码:

#include <bits/stdc++.h>
using namespace std;
using LL = long long;
#define int long long
signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n, m;
    cin >> n >> m;
    vector<pair<int, int>> a(n + 1);
    int sum = 0;
    for (int i = 1; i <= n; i++) {
        cin >> a[i].first >> a[i].second;
        sum = max(sum, a[i].second);
    }
    vector<int> dp1(m + 2);
    for (int i = 1; i <= n; i++) {
        for (int j = m; j >= a[i].first; j--) {
            dp1[j] = max(dp1[j], dp1[j - a[i].first] + a[i].second);
        }
    }
    vector<vector<int>> dp(n + 1, vector<int> (m + 2));
    int maxx = *max_element(dp1.begin(), dp1.end());
    for (int k = 1; k <= n; k++) {
        for (int i = 1; i <= n; i++) {
            if (i == k) {
                continue;
            }
            for (int j = m; j >= a[i].first; j--) {
                dp[k][j] = max(dp[k][j], dp[k][j - a[i].first] + a[i].second);
            }
        }
    }
    for (int i = 1; i <= n; i++) {
        int max1 = *max_element(dp[i].begin(), dp[i].end());
        if (max1 != maxx) {
            cout << "0\n";
        } else {
            int ans = 1e18;
            for (int j = 0; j <= m - a[i].first; j++) {
                ans = min(ans, maxx - dp[i][j] + 1 - a[i].second);
            }
            cout << ans << '\n';
        }
    }
    return 0;
}

清楚姐姐学01背包(Hard Version)

考虑降低时间复杂度为n方,dp[i][j]就是前i个蝴蝶结选择重量为j的所能得到的最大好看程度总和或后i个蝴蝶结选择重量为j的所能得到的最大好看程度总和,这样就能够得到dp[i-1][j]+dp[i+1][m-j],即去掉第i个蝴蝶结以后能到达的最大好看程度总和,dp[i-1][j]+dp[i+1][m-j-w[i]]也就是为第i个蝴蝶结留出空间但并未计算最大好看程度时的好看程度

AC代码:

#include <bits/stdc++.h>
using namespace std;
using LL = long long;
#define int long long
signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n, m;
    cin >> n >> m;
    vector<int> w(n + 1), v(n + 1);
    for (int i = 1; i <= n; i++) {
        cin >> w[i] >> v[i];
    }
    int maxx = 0;
    vector<vector<int>> dp1(n + 2,vector<int> (m + 1)), dp2(n + 2, vector<int> (m + 1));
    for (int i = 1; i <= n; i++) {
        dp1[i] = dp1[i - 1];
        for (int j = m; j >= w[i]; j--) {
            dp1[i][j] = max(dp1[i][j], dp1[i - 1][j - w[i]] + v[i]);
            maxx = max(dp1[i][j], maxx);
        }
    }
    for (int i = n; i >= 1; i--) {
        dp2[i] = dp2[i + 1];
        for (int j = m; j >= w[i]; j--) {
            dp2[i][j] = max(dp2[i][j], dp2[i + 1][j - w[i]] + v[i]);
        }
    }
    for (int i = 1; i <= n; i++) {
        int max1 = 0, max2 = 0;
        for (int j = 0; j <= m; j++) {
            max1 = max(max1, dp1[i - 1][j] + dp2[i + 1][m - j]);
        }
        for (int j = 0; j <= m - w[i]; j++) {
            max2 = max(max2, dp1[i - 1][j] + dp2[i + 1][m - j - w[i]]);
        }
        if (max1 != maxx) {
            cout << "0\n";
        } else {
            cout << maxx - max2 - v[i] + 1 << '\n';
        }
    }
    return 0;
}

清楚姐姐打怪升级

根据题意可以发现,当a>=h[i]的时候,可以一秒秒杀怪,当h[i]>a的时候,能杀死怪的前提是a-v[i]*t>0,否则每次攻击后怪都能把血量恢复起来

AC代码:

#include <bits/stdc++.h>
using namespace std;
using LL = long long;
#define int long long
signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    LL n, t, a;
    cin >> n >> t >> a;
    vector<pair<LL, LL>> x(n);
    LL ans = 0;
    for (int i = 0; i < n; i++) {
        cin >> x[i].first >> x[i].second;
    }
    for (int i = 0; i < n; i++) {
        if (i == 0) {
            if (x[i].first <= a) {
                ans = 1;
            } else {
                ans = 1;
                x[i].first -= a;
                if (x[i].second * t >= a) {
                    ans = -1;
                    break;
                } else {
                    LL p = a - x[i].second * t, z = (x[i].first + p - 1) / p;
                    ans += z * t;
                }
            }
        } else {
            if (x[i].first <= a) {
                ans += t;
            } else {
                x[i].first -= a;
                ans += t;
                if (x[i].second * t >= a) {
                    ans = -1;
                    break;
                } else {
                    LL p = a - x[i].second * t, z = (x[i].first + p - 1) / p;
                    ans += z * t;
                }
            }
        }
    }
    cout << ans << '\n';
    return 0;
}

清楚姐姐学树状数组

根据题意,二叉树中序遍历的结果是1~n,所以只需要考虑前序和后序遍历的结果。

根据这张图我们可以看出,我们能够计算出一个数到根的路径,即对于一个从低位往高位走的二进制,如果当前位为1的,如果他的高一位的二进制位仍然是1,那么去往根的下一个结点就是把这一位变成0,如果他的高一位的二进制位为0,去往根的下一个结点就是在加一个lowbit,从而我们得到了从某一结点到根的路径,这样我们就可以从根再往要求的结点走,可知,如果当前结点的值大于x,说明x在左子树,否则在右子树上,对于前序遍历,往左子树走,步数只需要+1,而往右子树走的话需要把左子树的儿子节点个数及其父节点都加上,也就是lowbit(当前节点编号)。再考虑后序遍历,如果当前节点编号小于x,说明x在右子树,因为是后序遍历,所以需要加上左子树的儿子节点个数,如果走到了x,并且x为奇数,可知x为叶子节点,不存在子树,不需要操作,如果x为偶数,说明x不是叶子节点,存在子树,所以需要加上x的儿子节点个数,即(lowbit(x)-1)*2

AC代码:

#include <bits/stdc++.h>
using namespace std;
using LL = long long;
#define int long long
#define lowbit(x) (x & (-x))
signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    map<int, int> mp;
    int res = 1;
    mp[1] = 0;
    for (int i = 1; i <= 61; i++) {
        res <<= 1;
        mp[res] = i;
    }
    int k, q;
    cin >> k >> q;
    while (q--) {
        int x, y;
        cin >> x;
        if (x == (1LL << k)) {
            cout << 1 << " " << (1LL << k) << " " << (1LL << k) << '\n';
            continue;
        }
        y = x;
        int ans = 1, ans1 = 1;
        vector<int> z;
        z.push_back(x);
        for (int i = mp[lowbit(x)] + 1; i <= 61; i++) {
            if (x >= (1LL << k)) {
                break;
            }
            if (x >> i & 1 && x >> (i - 1) & 1) {
                x -= lowbit(x);
                z.push_back(x);
            } else if ((x >> i) % 2 == 0 && (x >> (i - 1)) & 1) {
                x += lowbit(x);
                z.push_back(x);
            } else {
                break;
            }
        }
        int len = z.size();
        for (int i = len - 1; i > 0; i--) {
            if (y > z[i]) {
                ans += lowbit(z[i]);
            } else {
                ans++;
            }
        }
        for (int i = len - 1; i >= 0; i--) {
            if (y > z[i]) {
                ans1 += lowbit(z[i]) - 1;
            } else if (y == z[i] && y % 2 == 0) {
                ans1 += (lowbit(z[i]) - 1) * 2;
            }
        }
        cout << ans << " " << y << " " << ans1 << "\n";
    }
    return 0;
}

清楚姐姐逛街(Easy Version)

先把智乃所能到达每个点的最短时间bfs计算出来,然后每次询问暴力查找步数最少的点并且清楚姐姐用的步数不少于智乃哥哥

AC代码:

#include <bits/stdc++.h>
using namespace std;
using LL = long long;
struct node {
    int x, y;
};
int dx[] = {1, -1, 0, 0};
int dy[] = {0, 0, 1, -1};
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n, m, q;
    node st;
    cin >> n >> m >> st.x >> st.y >> q;
    st.x++;
    st.y++;
    vector<vector<char>> mp(n + 1, vector<char> (m + 1));
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= m; j++) {
            cin >> mp[i][j];
        }
    }
    vector<vector<int>> dist(n + 1, vector<int> (m + 1, -1));
    queue<node> qu;
    qu.push(st);
    dist[st.x][st.y] = 0;
    while (!qu.empty()) {
        node now = qu.front();
        qu.pop();
        for (int i = 0; i < 4; i++) {
            node nxt;
            nxt.x = now.x + dx[i];
            nxt.y = now.y + dy[i];
            if (mp[nxt.x][nxt.y] == '#' || dist[nxt.x][nxt.y] != -1) {
                continue;
            }
            dist[nxt.x][nxt.y] = dist[now.x][now.y] + 1;
            qu.push(nxt);
        }
    }
    while (q--) {
        node p;
        cin >> p.x >> p.y;
        p.x++;
        p.y++;
        int ans = -1;
        for (int i = 0; i <= n * m; i++) {
            if (dist[p.x][p.y] != -1 && i >= dist[p.x][p.y]) {
                ans = i;
                break;
            }
            if (mp[p.x][p.y] == '.') {
                continue;
            }
            node nxt = p;
            if (mp[nxt.x][nxt.y] == 'U') {
                nxt.x--;
            } else if (mp[nxt.x][nxt.y] == 'D') {
                nxt.x++;
            } else if (mp[nxt.x][nxt.y] == 'L') {
                nxt.y--;
            } else if (mp[nxt.x][nxt.y] == 'R') {
                nxt.y++;
            }
            if (mp[nxt.x][nxt.y] != '#') {
                p = nxt;
            }
        }
        cout << ans << '\n';
    }
    return 0;
}

清楚姐姐学排序

根据这个关系式,可以建立双层有向图,一层方向代表着大于关系,一层方向代表着小于关系,枚举根,dfs记录有多少数比根大,多少数比根小,如果两者之和为n-1个数,说明其他任意数都能通过种种关系,与根形成一种大于或小于关系,那么根的大小关系就是确定的

AC代码:

#include <bits/stdc++.h>
using namespace std;
using LL = long long;
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n, m;
    cin >> n >> m;
    vector<vector<int>> G(n + 1), G1(n + 1);
    for (int i = 0; i < m; i++) {
        int u, v;
        cin >> u >> v;
        G[u].push_back(v);
        G1[v].push_back(u);
    }
    vector<int> a(n + 1), b(n + 1);
    for (int i = 1; i <= n; i++) {
        vector<bool> vis(n + 1);
        int sum = 0;
        function<void(int)> dfs1 = [&](int u) {
            vis[u] = true;
            sum++;
            for (auto v : G[u]) {
                if (!vis[v]) {
                    dfs1(v);
                }
            }
        };
        dfs1(i);
        a[i] = sum;
        sum = 0;
        vector<bool> vis1(n + 1);
        function<void(int)> dfs2 = [&](int u) {
            vis1[u] = true;
            sum++;
            for (auto v : G1[u]) {
                if (!vis1[v]) {
                    dfs2(v);
                }
            }
        };
        dfs2(i);
        b[i] = sum;
    }
    vector<int> ans(n + 1, -1);
    for (int i = 1; i <= n; i++) {
        if (n + 1 == a[i] + b[i]) {
            ans[b[i]] = i;
        }
    }
    for (int i = 1; i <= n; i++) {
        cout << ans[i] << " \n"[i == n];
    }
    return 0;
}

清楚姐姐的三角形I

因为

Va=Lb+Lc

Vb=La+Lc

Vc=La+Lb

所以联立可得

2*La=Vb+Vc-Va

2*Lb=Va+Vc-Vb

2*Lc=Va+Vb-Vc

因此,如果有奇数则不可能成立,并且如果边有小于等于0的也不成立,两条较小的边的和必须大于最大的边,注意输出顺序

AC代码:

#include <bits/stdc++.h>
using namespace std;
using LL = long long;
#define int long long
signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int T;
    cin >> T;
    while (T--) {
        LL x, y, z;
        cin >> x >> y >> z;
        vector<LL> a(3);
        LL sum = x + y + z;
        if (sum % 2 == 1) {
            cout << "No\n";
            continue;
        }
        sum /= 2;
        LL xx = sum - x, yy = sum - y, zz = sum - z;
        a[0] = sum - x;
        a[1] = sum - y;
        a[2] = sum - z;
        sort(a.begin(), a.end());
        if (a[0] <= 0) {
            cout << "No\n";
        } else if (a[0] + a[1] <= a[2]) {
            cout << "No\n";
        } else {
            cout << "Yes\n";
            cout << xx << " " << yy << " " << zz << '\n';
        }
    }
    return 0;
}

清楚姐姐的三角形II

很多种构造方式,只要不满足三角形即可

AC代码:

#include <bits/stdc++.h>
using namespace std;
using LL = long long;
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;
    cin >> n;
    vector<int> a(45);
    a[1] = 1, a[2] = 1;
    for (int i = 3; i <= 44; i++) {
        a[i] = a[i - 1] + a[i - 2];
    }
    int x = n / 44, y = n % 44;
    for (int i = 0; i < x; i++) {
        for (int j = 1; j <= 44; j++) {
            cout << a[j] << " ";
        }
    }
    for (int i = 1; i <= y; i++) {
        cout << a[i] << " ";
    }
    cout << '\n';
    return 0;
}

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/187969.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

7年老码农,平凡的2022

前言 嗨&#xff0c;大家好&#xff0c;我是希留。一个被迫致力于成为一名全栈开发的菜鸟。 2022年对于大多数人而言是难忘的一年&#xff0c;受疫情影响、经历行业寒冬。裁员、失业等情况总是笼罩着本就焦虑不安的生活。 而我的2022&#xff0c;用一个关键词就可以概括&…

超大功率远程应急广播系统(大功率扬声器的应用)

系统概述 1、接收控制系统框图 超大功率远程应急广播系统是针对应急广播研发的一套通信系统&#xff0c;其接收控制系统框图如图&#xff08;1&#xff09;所示&#xff1a; 2、发射系统框图 发射系统框图如图&#xff08;2&#xff09;所示。 3、接收控制系统功能 接收控制…

【Spring源码】自动注入·名称:autowireByName()详解

进入方法autowireByName()首先调用了unsatisfiedNonSimpleProperties()方法进行属性过滤unsatisfiedNonSimpleProperties()其中PropertyDescriptor是JavaBean通过存储器导出一个的一个属性&#xff0c;用于获取bw的所有属性描述对象&#xff0c;遍历获取到的属性描述对象&#…

快鲸智慧楼宇:为楼宇智慧化、物联化、可视化、数字化运营赋能

根据国际数据公司(IDC)发布的《全球半年度智慧城市支出指南》显示&#xff0c;2023年全球智慧城市支出预计将达到1894.6亿美元&#xff0c;其中中国市场规模将达到389.2亿美元。这意味着2023年&#xff0c;建设智慧城市是世界各地许多城市的发展战略之一。智慧楼宇作为智慧城市…

二叉树(三)

我们之前对树和二叉树有了基本的了解&#xff0c;然后我们进一步对二叉树的性质进行分类。小伙伴们如果有疑问或者感兴趣的可以看一下我之前写的两篇博客。二叉树&#xff08;一&#xff09;&#xff1a;二叉树&#xff08;一&#xff09;_染柒_GRQ的博客-CSDN博客二叉树&#…

一文读懂卫星导航测量天线

1957年10月4日&#xff0c;前苏联发射了第一颗人造地球卫星&#xff0c;第二年&#xff0c;美国便启动了第一代卫星导航系统——子午仪卫星导航系统的研制。经过几十年的发展&#xff0c;全球各类航天器发射活动日益增多&#xff0c;全球卫星导航卫星系统&#xff08;GNSS&…

【go语言udp分析】

go语言udp分析serverclientudp相等于tcp来说是不可靠的协议&#xff0c;当然优点就是速度快&#xff0c;相对于包的首部来说比较小。然后接下来看一下对应的实现server package mainimport ("fmt""net" )// UDP服务端配置 func main() {//1:启动监听liste…

2023年中高级前端养成指南-需要关注和学习的13大类80余个前端技术栈与前端趋势-看这篇就够了系列

今天是兔年开工的第一个星期一&#xff0c;我们又要投入到忙碌的工作了。 以下是imqdcn研究整理的2023年中高级前端养成指南&#xff0c;收藏起来&#xff0c;从开工第一天起&#xff0c;立下全新的计划和目标&#xff0c;愿你在兔年大展宏兔&#xff0c;扬眉兔气。 文章目录一…

【SpringCloud】Sentinel的基础概念及使用

一、雪崩问题1.问题描述微服务中&#xff0c;服务间调用关系错综复杂&#xff0c;一个微服务往往依赖于多个其它微服务。如果服务提供者I发生了故障&#xff0c;当前的应用的部分业务因为依赖于服务I&#xff0c;因此也会被阻塞。此时&#xff0c;其它不依赖于服务I的业务似乎不…

SAP 实施新的金融工具 IFRS17规则解析

在实施新的金融工具 IFRS 规则的过程中&#xff0c;保险公司现在看到了保险负债的新标准。经过多年的长期讨论&#xff0c;IASB 于 2016 年 11 月承诺在 2021 年 1 月 1 日生效&#xff0c;并明确表示不会考虑进一步推迟法规的通过日期。由于有必要将 2020 年作为比较期&#x…

[思考进阶]05 人与人之间的差距,在于“自律”

除了要提升自己的技术能力&#xff0c;思维的学习和成长也非常非常重要&#xff0c;特推出此[思考进阶]系列&#xff0c;进行刻意练习&#xff0c;从而提升自己的认知。 我认识两个成功的长者。 其中有一个人&#xff0c;每天记录当天的重要事项&#xff0c;比如今天和谁签了什…

英语学习 1

1 词汇积累 1、evolution 进化、发展 2、work efficiency 工作效率 3、material 物质的、非精神上的 4、mental 精神的 5、concern 担忧 6、physical contact 身体接触 7、imply 暗示 8、interpersonal relationships 人际关系 9、indifference 漠不关心 10、depression 抑郁 …

【八大数据排序法】冒泡排序法的图形理解和案例实现 | C++

第十四章 冒泡排序法 目录 第十四章 冒泡排序法 ●前言 ●认识排序 ●一、冒泡排序是什么&#xff1f; 1.简要介绍 2.具体情况 3.算法分析 ●二、案例实现 1.案例一 2.案例二 ●总结 前言 排序算法是我们在程序设计中经常见到和使用的一种算法&#xff0c;它…

在线支付系列【10】微信支付接入前准备

有道无术&#xff0c;术尚可求&#xff0c;有术无道&#xff0c;止于术。 文章目录前言1. 获取基本参数商户号&#xff08;mchid&#xff09;应用ID&#xff08;appid&#xff09;绑定商户号和应用ID2. 配置API v3密钥3. 下载并配置商户API证书3.1 简介3.2 生成证书串3.3 获得商…

卷积神经网络CNN :1.基础知识

​卷积神经网络是一种深度学习概念&#xff0c;专为处理图像而构建。机器学习是计算机从过去的经验中学习的概念。深度学习是机器学习的高级部分。CNN 旨在寻找视觉模式。 当我们人类看到图像时&#xff0c;我们看到物体、颜色等。我们在成长过程中学习这些东西&#xff0c;但计…

CRPS:贝叶斯机器学习模型的评分函数

连续分级概率评分&#xff08;Continuous Ranked Probability Score, CRPS&#xff09;或“连续概率排位分数”是一个函数或统计量&#xff0c;可以将分布预测与真实值进行比较。 机器学习工作流程的一个重要部分是模型评估。这个过程本身可以被认为是常识&#xff1a;将数据分…

【CLYZ集训】变量取值【网络流】

思路&#xff1a; 容易把答案转化为∑siwi∑ti(wx−wy)\sum{s_iw_i}\sum{t_i(w_x-w_y)}∑si​wi​∑ti​(wx​−wy​)&#xff0c;然后我们设初始代价为−∑∣si∣wi-\sum{|s_i|w_i}−∑∣si​∣wi​&#xff0c;然后考虑建模。 如果Si大于0&#xff0c;则源点向i连一条流量为2…

【Java AWT 图形界面编程】FileDialog 对话框 ( 打开文件 | 保存文件 | 构造函数 | 获取文件路径 | 获取文件名称 | 代码示例 )

文章目录一、FileDialog 对话框1、构造函数2、获取文件路径3、获取文件名称二、FileDialog 对话框代码示例一、FileDialog 对话框 在开发时 , 经常遇到文件相关操作 , 如 : 选择文件 , 保存文件 等 , 在 AWT 中使用 FileDialog 文件对话框 实现上述功能 ; 1、构造函数 FileDial…

量子计算初创公司Oxford Ionics完成3000万英镑A轮融资

&#xff08;图片来源&#xff1a;网络&#xff09;未来&#xff0c;量子计算机会解决世界上最大的超级计算机无法解决的问题。然而&#xff0c;大规模制造量子计算机仍然是一个巨大的挑战。英国量子计算初创公司Oxford IonicsA轮融资获得的3000万英镑&#xff08;约合人民币2.…

Java集合(六)Set接口和常用方法

Set接口基本介绍&#xff1a; &#xff08;1&#xff09;无序&#xff08;添加和取出的顺序不一致&#xff09;&#xff0c;没有索引 &#xff08;2&#xff09;不允许重复元素&#xff0c;所以最多包含一个null (3)JDK API中Set接口的实现类有&#xff1a; 其中set接口的已…