多项式A除以B 原题链接#include <cstdio>#include <cmath>using namespace std;int nonNegativeNum(double c[], int start) { int cnt = 0; for (int i = start; i >= 0; i--) if (abs(c[i]) + 0.05 >= 0.1) cnt++; return cnt;}void printPoly(do
L2-007 家庭房产 (25 分) 原题链接#include <stdio.h>#include <iostream>#include <map>#include <set>#include <algorithm>using namespace std;int N, M, K;const int si = 10007;int par[si];int cnt[si];double area[si];int housenum[si];bool vis[si];
L2-006 树的遍历 (25 分) 原题链接#include<bits/stdc++.h>using namespace std;typedef struct node* bintree;int post[40],in[40]; int n;vector<node> tree;int p=-1;struct node{ int data; int l,r;};int create(int postl,int postr,int inl,int inr){ int i
L2-005 集合相似度 (25 分) 原题链接#include <bits/stdc++.h>using namespace std;set<int> st[100];set<int> sc, se;int main(){ int n, k, x; cin >> n; for (int i = 1; i <= n; i++) { cin >> k; for (int j = 0; j < k; j+
L2-004 这是二叉搜索树吗? (25 分) 原题链接#include <bits/stdc++.h>using namespace std;int ismirror;vector<int> pre, post;void getpost(int root, int tail){ if (root > tail) return; int i = root + 1, j = tail; if (!ismirror) { while (i <= t
L2-003 月饼 (25 分) 原题链接#include<bits/stdc++.h>using namespace std;struct node{ double liang; double danjia; double zong;}p[1111];bool cmp(node a,node b){ return tie(a.danjia)>tie(b.danjia);}int main(){ int n,x; cin>>n>>x;
L2-002 链表去重 (25 分) 原题链接#include <bits/stdc++.h>using namespace std;const int N = 1e9;int vis[111111];struct node{ int adress; int key; int next; int num;} p[111111];bool cmp(node a, node b){ return a.num < b.num;}int main(){ int h
L2-001 紧急救援 (25 分) 原题链接#include<bits/stdc++.h>using namespace std;int cnt[1111]; //最短路径条数int book[1111]; //各个城市是否经过int jiu[1111]; //每个城市救援队数量int jiuyuan[1111]; //到达该城市召集的所有救援队的数量int pre[1111]; //到达该城市前所经历的编号int n, m,s,d,u;int inf = 9999999;int
L2-008 最长对称子串 (25 分) 原题链接#include <bits/stdc++.h>using namespace std;int main(){ string s; getline(cin, s); int ans = 1; for (int i = 0; i < s.length(); i++) { for (int j = s.length() - 1; j >= i; j--) { int l = i
L2-009 抢红包 (25 分) 原题链接#include<bits/stdc++.h>using namespace std;struct node{ double shou,fa; int geshu; double shouru; int num;}p[11111];bool cmp(node a,node b){ return tie(a.shouru,a.geshu,b.num)>tie(b.shouru,b.geshu,a.num);}int b,t;/
L2-010 排座位 (25 分) 原题链接#include <bits/stdc++.h>using namespace std;int f[1111];int c[111][111];void init(){ for (int i = 0; i < 111; i++) { f[i] = i; }}int find(int x){ return f[x] == x ? x : f[x] = find(f[x]);}void merge(int x, in
L2-011 玩转二叉树 (25 分) 原题链接#include <bits/stdc++.h>using namespace std;vector<int> level(10000, -1);vector<int> in, pre;void leveorder(int root, int start, int end, int index){ if (start > end) return; int i = start; while (i < e
L2-012 关于堆的判断 (25 分) 原题链接#include<bits/stdc++.h>using namespace std;int a[111111],cnt;int inf=999999999;map<int,int>p;void creat(int x){ a[++cnt]=x; int t=cnt; while (t>1&&(a[t/2]>a[t])) { a[t]=a[t/2]; a[t/2]=x;
L2-013 红色警报 (25 分) 原题链接#include<bits/stdc++.h>using namespace std;int f[600];int lost[600];int n,m,a,b;vector<int >w;struct node{ int x,y;}road[5100];int get(int x){ return f[x]==x?f[x]:f[x]=get(f[x]);}void merge(int x,int y){ int nx=g
L2-014 列车调度 (25 分) 原题链接#include <bits/stdc++.h>using namespace std;set<int> s;int main(){ int n,x; cin >> n; for (int i = 0; i < n; i++) { cin >> x; auto e=s.lower_bound(x); if(e!=s.end()) {
L2-015 互评成绩 (25 分) 原题链接#include <bits/stdc++.h>using namespace std;vector<int> v[11111];int x;vector<double> st;int main(){ int n, m, k; cin >> n >> k >> m; for (int i = 0; i < n; i++) { for (int j = 0; j
L2-016 愿天下有情人都是失散多年的兄妹 (25 分) 原题链接#include <bits/stdc++.h>using namespace std;vector<int> v[111111];int vis[111111];int f;void dfs(int x, int y){ if (y >= 4) return; vis[x] = 1; for (int i = 0; i < v[x].size(); i++) { if (vis[v[x
L2-017 人以群分 (25 分) 原题链接#include<bits/stdc++.h>using namespace std;int q[200000];int sum,sum1,sum3,sum2;int main(){int n;cin>>n;for(int i=0;i<n;i++){ cin>>q[i];}sort(q,q+n);if(n%2==0){ for(int i=0;i<n/2;i++) sum+=q[i]; fo
L2-019 悄悄关注 (25 分) 原题链接#include<bits/stdc++.h>using namespace std;struct node{ string s; int q;}p[11111];double sum;int flag=0;map<string,int>w;bool cmp(node a,node b){ return tie(a.s)<tie(b.s);}int main(){ int n; cin>>n;
L2-020 功夫传人 (25 分) 原题链接#include <bits/stdc++.h>using namespace std;int n, k, x;double z, r, ans;double p[111111];int vis[111111];vector<int> w[111111];void bfs(int x){ queue<int> vv; vv.push(x); while (!vv.empty()) { int tem