[费用流专题]Going Home,Minimum Cost,工作安排

文章目录

  • T1:Going Home
    • 题目
    • 题解
    • CODE
  • T2:Minimum Cost
    • 题目
    • 题解
    • CODE
  • T3:工作安排
    • 题解
    • CODE

T1:Going Home

题目

On a grid map there are n little men and n houses. In each unit time, every little man can move one unit step, either horizontally, or vertically, to an adjacent point. For each little man, you need to pay a $1 travel fee for every step he moves, until he enters a house. The task is complicated with the restriction that each house can accommodate only one little man.

Your task is to compute the minimum amount of money you need to pay in order to send these n little men into those n different houses. The input is a map of the scenario, a ‘.’ means an empty space, an ‘H’ represents a house on that point, and am ‘m’ indicates there is a little man on that point.
在这里插入图片描述
You can think of each point on the grid map as a quite large square, so it can hold n little men at the same time; also, it is okay if a little man steps on a grid with a house without entering that house.
Input
There are one or more test cases in the input. Each case starts with a line giving two integers N and M, where N is the number of rows of the map, and M is the number of columns. The rest of the input will be N lines describing the map. You may assume both N and M are between 2 and 100, inclusive. There will be the same number of 'H’s and 'm’s on the map; and there will be at most 100 houses. Input will terminate with 0 0 for N and M.
Output
For each test case, output one line with the single integer, which is the minimum amount, in dollars, you need to pay.
Sample Input
2 2
.m
H.
5 5
HH…m



mm…H
7 8
…H…
…H…
…H…
mmmHmmmm
…H…
…H…
…H…
0 0
Sample Output
2
10
28

题解

简单题意就是一张图,HHH表示一间屋子,mmm表示一个人,现在每个人要走到一间屋子里,消耗的费用为两点之间的距离,求每个都有一个房子的最小耗费


是一道很裸的费用流问题,这里本蒟蒻选择了EK+SPFAEK+SPFAEK+SPFA
我们考虑建图问题,先建一个超级源点s和一个超级汇点t,然后将所有房子HHH和s建边,容量定义为1,边权免费,同理把所有人在的mmm和t建边,容量为1,边权免费
最后的边权决定于房子和人的搭配,这个边权就是矩阵里面两个点之间的距离,容量仍然是1,因为一人一间房
在这里插入图片描述

CODE

#include <queue>
#include <cmath>
#include <vector>
#include <cstdio>
#include <cstring>
using namespace std;
#define INF 1e9
#define MAXM 1000005
#define MAXN 100005
struct node {int v, w, next, c, flow;
}edge[MAXM];
queue < int > q;
vector < pair < int, int > > h, m;
//处理出每一个房子和人所在的位置,第一关键字是行,第二关键字是列
int cnt, N, M, s, t;
int head[MAXN], dis[MAXN], pre[MAXN];
bool vis[MAXN];void add ( int x, int y, int flow, int fi ) {edge[cnt].next = head[x];edge[cnt].v = y;edge[cnt].w = fi;edge[cnt].c = flow;edge[cnt].flow = 0;head[x] = cnt ++;	
}bool spfa () {memset ( vis, 0, sizeof ( vis ) ); memset ( dis, 0x7f, sizeof ( dis ) );memset ( pre, -1, sizeof ( pre ) );while ( ! q.empty() )q.pop();q.push( s );dis[s] = 0;vis[s] = 1;while ( ! q.empty() ) {int u = q.front();q.pop();vis[u] = 0;for ( int i = head[u];i != -1;i = edge[i].next ) {int v = edge[i].v;if ( dis[v] > dis[u] + edge[i].w && edge[i].c > edge[i].flow ) {dis[v] = dis[u] + edge[i].w;pre[v] = i;if ( ! vis[v] ) {q.push( v );vis[v] = 1;}}}} return pre[t] != -1;
}void MCMF ( int &maxflow, int &mincost ) {maxflow = mincost = 0;while ( spfa() ) {int MIN = INF;for ( int i = pre[t];i != -1;i = pre[edge[i ^ 1].v] )MIN = min ( MIN, edge[i].c - edge[i].flow );for ( int i = pre[t];i != -1;i = pre[edge[i ^ 1].v] ) {edge[i].flow += MIN;edge[i ^ 1].flow -= MIN;mincost += MIN * edge[i].w;}maxflow += MIN;}
}int Fabs ( int x ) {if ( x < 0 )return -x;return x;
}int main() {while ( scanf ( "%d %d", &N, &M ) ) {if ( N == 0 && M == 0 )return 0;memset ( head, -1, sizeof ( head ) );cnt = 0;h.clear();m.clear(); for ( int i = 1;i <= N;i ++ ) {getchar();for ( int j = 1;j <= M;j ++ ) {char ch;scanf ( "%c", &ch );if ( ch == 'H' )h.push_back( make_pair ( i, j ) );if ( ch == 'm' )m.push_back ( make_pair ( i, j ) );}}s = 0;t = N * M + 1;for ( int i = 0;i < h.size();i ++ ) {//与超级源点建边add ( s, ( h[i].first - 1 ) * M + h[i].second, 1, 0 );add ( ( h[i].first - 1 ) * M + h[i].second, s, 0, 0 );for ( int j = 0;j < m.size();j ++ ) {//屋子与人建边,算是一种hash吧,毕竟每一个人和每一件房子都是独一无二的add ( ( h[i].first - 1 ) * M + h[i].second, ( m[j].first - 1 ) * M + m[j].second, 1, Fabs ( h[i].first - m[j].first ) + Fabs ( h[i].second - m[j].second ) );add ( ( m[j].first - 1 ) * M + m[j].second, ( h[i].first - 1 ) * M + h[i].second, 0, - Fabs ( h[i].first - m[j].first ) - Fabs ( h[i].second - m[j].second ) );}}//与超级汇点建边for ( int i = 0;i < m.size();i ++ ) {add ( ( m[i].first - 1 ) * M + m[i].second, t, 1, 0 );add ( t, ( m[i].first - 1 ) * M + m[i].second, 0, 0 );}int maxflow, mincost;MCMF ( maxflow, mincost );printf ( "%d\n", mincost );}return 0;
} 

T2:Minimum Cost

题目

Dearboy, a goods victualer, now comes to a big problem, and he needs your help. In his sale area there are N shopkeepers (marked from 1 to N) which stocks goods from him.Dearboy has M supply places (marked from 1 to M), each provides K different kinds of goods (marked from 1 to K). Once shopkeepers order goods, Dearboy should arrange which supply place provide how much amount of goods to shopkeepers to cut down the total cost of transport.

It’s known that the cost to transport one unit goods for different kinds from different supply places to different shopkeepers may be different. Given each supply places’ storage of K kinds of goods, N shopkeepers’ order of K kinds of goods and the cost to transport goods for different kinds from different supply places to different shopkeepers, you should tell how to arrange the goods supply to minimize the total cost of transport.
Input
The input consists of multiple test cases. The first line of each test case contains three integers N, M, K (0 < N, M, K < 50), which are described above. The next N lines give the shopkeepers’ orders, with each line containing K integers (there integers are belong to [0, 3]), which represents the amount of goods each shopkeeper needs. The next M lines give the supply places’ storage, with each line containing K integers (there integers are also belong to [0, 3]), which represents the amount of goods stored in that supply place.

Then come K integer matrices (each with the size N * M), the integer (this integer is belong to (0, 100)) at the i-th row, j-th column in the k-th matrix represents the cost to transport one unit of k-th goods from the j-th supply place to the i-th shopkeeper.

The input is terminated with three "0"s. This test case should not be processed.
Output
For each test case, if Dearboy can satisfy all the needs of all the shopkeepers, print in one line an integer, which is the minimum cost; otherwise just output “-1”.
Sample Input
1 3 3
1 1 1
0 1 1
1 2 2
1 0 1
1 2 3
1 1 1
2 1 1

1 1 1
3
2
20

0 0 0
Sample Output
4
-1

题解

其实这道题有点考语文,输入太**
在这里插入图片描述
我们考虑建一个超级源点和超级汇点,
在源点和店主的需求之间建一条边,没有中间商赚差价,容量自然就是店主的订单量,
同理在供应地点和超级汇点之间建一条边,也没有中间商赚差价,容量为供应地点生产的产品数;
最后就是店主与供应地点之间的建边,因为有kkk种不同的商品,所以一个供应地点跟一个店主之间的成本也会随着kkk的不一样而改变,两个解决办法
在这里插入图片描述
1.把一个供应地点拆成kkk个彼此独立的供应柜台,专门只销售一种类型的
由上面我们就可以发现,柜台之间是彼此独立的,互不影响,所以我们就有了第二种解决方案
2.把费用流拆成kkk次一种商品的费用流,每次费用流都只处理一种商品,这样建边就不那么冗长

CODE

#include <queue>
#include <cmath>
#include <vector>
#include <cstdio>
#include <cstring>
using namespace std;
#define INF 1e9
#define MAXN 100
struct node {int v, w, next, c, flow;
}edge[MAXN * MAXN];
queue < int > q;
int cnt, n, m, k, s, t;
int head[MAXN], dis[MAXN], pre[MAXN], need[MAXN][MAXN], num[MAXN][MAXN], matrix[MAXN][MAXN][MAXN];
bool vis[MAXN];void add ( int x, int y, int flow, int cost ) {edge[cnt].next = head[x];edge[cnt].v = y;edge[cnt].w = cost;edge[cnt].c = flow;edge[cnt].flow = 0;head[x] = cnt ++;	
}bool spfa () {memset ( vis, 0, sizeof ( vis ) ); memset ( dis, 0x7f, sizeof ( dis ) );memset ( pre, -1, sizeof ( pre ) );while ( ! q.empty() )q.pop();q.push( s );dis[s] = 0;vis[s] = 1;while ( ! q.empty() ) {int u = q.front();q.pop();vis[u] = 0;for ( int i = head[u];~ i;i = edge[i].next ) {int v = edge[i].v;if ( dis[v] > dis[u] + edge[i].w && edge[i].c > edge[i].flow ) {dis[v] = dis[u] + edge[i].w;pre[v] = i;if ( ! vis[v] ) {q.push( v );vis[v] = 1;}}}} return pre[t] != -1;
}void MCMF ( int &maxflow, int &mincost ) {maxflow = mincost = 0;while ( spfa() ) {int MIN = INF;for ( int i = pre[t];~ i;i = pre[edge[i ^ 1].v] )MIN = min ( MIN, edge[i].c - edge[i].flow );for ( int i = pre[t];~ i;i = pre[edge[i ^ 1].v] ) {edge[i].flow += MIN;edge[i ^ 1].flow -= MIN;mincost += MIN * edge[i].w;}maxflow += MIN;}
}int main() {while ( scanf ( "%d %d %d", &n, &m, &k ) != EOF ) {if ( n == 0 && m == 0 && k == 0 )return 0;int sum = 0;for ( int i = 1;i <= n;i ++ )for ( int j = 1;j <= k;j ++ ) {scanf ( "%d", &need[i][j] );sum += need[i][j];}for ( int i = 1;i <= m;i ++ )for ( int j = 1;j <= k;j ++ )scanf ( "%d", &num[i][j] );for ( int i = 1;i <= k;i ++ )for ( int j = 1;j <= n;j ++ )for ( int p = 1;p <= m;p ++ )scanf ( "%d", &matrix[i][j][p] );s = 0;t = n + m + 1;int result = 0, Flow = 0;for ( int i = 1;i <= k;i ++ ) {memset ( head, -1, sizeof ( head ) );cnt = 0;for ( int j = 1;j <= n;j ++ ) {add ( s, j, need[j][i], 0 );add ( j, s, 0, 0 );}for ( int j = 1;j <= n;j ++ )for ( int p = 1;p <= m;p ++ ) {add ( j, n + p, num[p][i], matrix[i][j][p] );add ( n + p, j, 0, -matrix[i][j][p] );}for ( int j = 1;j <= m;j ++ ) {add ( j + n, t, num[j][i], 0 );add ( t, j + n, 0, 0 );}int mincost, maxflow;MCMF ( maxflow, mincost );result += mincost;Flow += maxflow;}if ( Flow == sum )printf ( "%d\n", result );elseprintf ( "-1\n" );}return 0;
} 

T3:工作安排

你的公司接到了一批订单。订单要求你的公司提供n类产品,产品被编号为1n1~n1 n,其中第i类产品共需要Ci件。公司共有m名员工,员工被编号为1m1~m1 m员工能够制造的产品种类有所区别。一件产品必须完整地由一名员工制造,不可以由某名员工制造一部分配件后,再转交给另外一名员工继续进行制造。

我们用一个由0和1组成的m*n的矩阵A来描述每名员工能够制造哪些产品。矩阵的行和列分别被编号为1m1~m1 m1n1~n1 n,Ai,j为1表示员工i能够制造产品j,为0表示员工i不能制造产品j。

如果公司分配了过多工作给一名员工,这名员工会变得不高兴。我们用愤怒值来描述某名员工的心情状态。愤怒值越高,表示这名员工心情越不爽,愤怒值越低,表示这名员工心情越愉快。员工的愤怒值与他被安排制造的产品数量存在某函数关系,鉴于员工们的承受能力不同,不同员工之间的函数关系也是有所区别的。

对于员工i,他的愤怒值与产品数量之间的函数是一个Si+1段的分段函数。当他制造第1Ti1~Ti1 Ti,1件产品时,每件产品会使他的愤怒值增加Wi,1,当他制造第Ti,1+1Ti,2Ti,1+1~Ti,2Ti,1+1 Ti,2件产品时,每件产品会使他的愤怒值增加Wi,2……Wi,2……Wi,2为描述方便,设Ti,0=0,Ti,si+1=+∞,Ti,0=0,Ti,si+1=+∞,Ti,0=0,Ti,si+1=+那么当他制造第Ti,j−1+1Ti,jTi,j-1+1~Ti,jTi,j1+1 Ti,j件产品时,每件产品会使他的愤怒值增加Wi,j,1≤j≤Si+1Wi,j, 1≤j≤Si+1Wi,j1jSi+1

你的任务是制定出一个产品的分配方案,使得订单条件被满足,并且所有员工的愤怒值之和最小。由于我们并不想使用Special Judge,也为了使选手有更多的时间研究其他两道题目,你只需要输出最小的愤怒值之和就可以了。

Input
第一行包含两个正整数m和n,分别表示员工数量和产品的种类数;
第二行包含n 个正整数,第i个正整数为Ci;

以下m行每行n 个整数描述矩阵A;
下面m个部分,第i部分描述员工i的愤怒值与产品数量的函数关系。每一部分由三行组成:第一行为一个非负整数Si,第二行包含Si个正整数,其中第j个正整数为Ti,j,如果Si=0那么输入将不会留空行(即这一部分只由两行组成)。第三行包含Si+1个正整数,其中第j个正整数为Wi,j。

Output
仅输出一个整数,表示最小的愤怒值之和。

Sample Input
2 3
2 2 2
1 1 0
0 0 1
1
2
1 10
1
2
1 6
Sample Output
24

Hint
在这里插入图片描述

题解

考语文啊~~
在这里插入图片描述
这道题的提示,保证了愤怒值是单调递增的,就是费用流的关键,给我们的解题提供了保障
我们考虑对于一堆产品,第一阶段的产品生产的愤怒值一定小于后面阶段的产品生产的愤怒值,那么我们把愤怒值当成费用,我们一定会先选择第一阶段的流量边再选择第二阶段的流量边,这样就不会出现直接生产第二阶段导致我们的出错


那么我们就建一个超级源点和超级汇点,源点和员工之间连边,员工和产品之间连边,边数就是员工的愤怒阶段+1+1+1,最后一段是infinfinf,每个阶段对应的容量就是该阶段的产品数,费用就是愤怒值;最后是产品和汇点之间连边

CODE

#include <queue>
#include <cmath>
#include <vector>
#include <cstdio>
#include <cstring>
using namespace std;
#define INF 1e9
#define LL long long
#define MAXN 1005
struct node {int v, next;LL w, c, flow;
}edge[MAXN * MAXN];
queue < int > q;
int cnt, n, m, s, t;
int head[MAXN], pre[MAXN], C[MAXN], a[MAXN][MAXN], b[MAXN];
bool vis[MAXN];
LL dis[MAXN];void add ( int x, int y, LL flow, LL cost ) {edge[cnt].next = head[x];edge[cnt].v = y;edge[cnt].w = cost;edge[cnt].c = flow;edge[cnt].flow = 0;head[x] = cnt ++;	
}bool spfa () {memset ( vis, 0, sizeof ( vis ) ); memset ( dis, 0x7f, sizeof ( dis ) );memset ( pre, -1, sizeof ( pre ) );while ( ! q.empty() )q.pop();q.push( s );dis[s] = 0;vis[s] = 1;while ( ! q.empty() ) {int u = q.front();q.pop();vis[u] = 0;for ( int i = head[u];~ i;i = edge[i].next ) {int v = edge[i].v;if ( dis[v] > dis[u] + edge[i].w && edge[i].c > edge[i].flow ) {dis[v] = dis[u] + edge[i].w;pre[v] = i;if ( ! vis[v] ) {q.push( v );vis[v] = 1;}}}} return pre[t] != -1;
}void MCMF ( LL &maxflow, LL &mincost ) {maxflow = mincost = 0;while ( spfa() ) {LL MIN = INF;for ( int i = pre[t];~ i;i = pre[edge[i ^ 1].v] )MIN = min ( MIN, edge[i].c - edge[i].flow );for ( int i = pre[t];~ i;i = pre[edge[i ^ 1].v] ) {edge[i].flow += MIN;edge[i ^ 1].flow -= MIN;mincost += MIN * edge[i].w;}maxflow += MIN;}
}int main() {memset ( head, -1, sizeof ( head ) );scanf ( "%d %d", &m, &n );s = 0;t = n + m + 1;for ( int i = 1;i <= n;i ++ ) {scanf ( "%d", &C[i] );add ( s, i, C[i], 0 );add ( i, s, 0, 0 );}for ( int i = 1;i <= m;i ++ )for ( int j = 1;j <= n;j ++ ) {scanf ( "%d", &a[i][j] );if ( a[i][j] ) {add ( j, i + n, INF, 0 );add ( i + n, j, 0, 0 );}}for ( int i = 1;i <= m;i ++ ) {int S;scanf ( "%d", &S );for ( int j = 1;j <= S;j ++ )scanf ( "%d", &b[j] );b[S + 1] = INF;for ( int j = 1;j <= S + 1;j ++ ) {int w;scanf ( "%d", &w );add ( i + n, t, ( b[j] - b[j - 1] ), w );add ( t, i + n, 0, -w );}}LL maxflow, mincost;MCMF ( maxflow, mincost );printf ( "%lld", mincost );return 0;
} 

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

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

相关文章

Sky Garden

Sky Garden 题意&#xff1a; 画n个圆和m条直线&#xff0c;圆的中心点为(0,0)&#xff0c;圆的半径分别从1到n&#xff0c;而直线都必经过(0,0)点&#xff0c;并且所有直线会把每个圆平均分成2m个面积相等的区域&#xff0c;直线会和圆形成交点&#xff0c;求所有交点两两经…

IdentityServer4-前后端分离的授权验证(六)

上两节介绍完Hybrid模式在MVC下的使用&#xff0c;包括验证从数据获取的User和Claim对MVC的身份授权。本节将介绍Implicit模式在JavaScript应用程序中的使用&#xff0c;使用Node.jsExpress构建JavaScript客户端&#xff0c;实现前后端分离。本节授权服务和资源服务器基于第四和…

人类智慧贪心

题意看起来很清新&#xff0c;代码实现也基本在入门难度&#xff0c;但是为什么我不会&#xff01; 另&#xff1a;反悔贪心 <details><summary>$\texttt{solution}$</summary></details> P2672 [NOIP2015 普及组] 推销员 $\texttt{solution}$ 发现答案…

周末狂欢赛3(跳格子,英雄联盟,排序问题)

文章目录T1&#xff1a;跳格子题目题解CODET2&#xff1a;英雄联盟题目题解CODET3&#xff1a;排序问题题目题解CODET1&#xff1a;跳格子 题目 n 个格子排成一列&#xff0c;一开始&#xff0c;你在第一个格子&#xff0c;目标为跳到第 n 个格子。在每个格子 i 里面你可以做…

想让AI在企业落地?微软最新Azure AI不容错过!

Microsoft Connect(); 2018 如期举行&#xff0c;大会上发布的众多顶尖技术&#xff0c;瞬间引爆了全球&#xff01;AI的高速发展&#xff0c;正在掀起新一波的创新浪潮。对于很多企业来说&#xff0c;AI创造的巨大价值&#xff0c;是不容错过的风口&#xff0c;大会上&#xf…

[费用流]数字配对,新生舞会

文章目录T1&#xff1a;数字配对题目题解CODET2&#xff1a;新生舞会题目题解CODE&#xff08;最大费用最大流版&#xff09;CODE&#xff08;最小费用最大流版&#xff09;T1&#xff1a;数字配对 题目 有 n 种数字&#xff0c;第 i 种数字是 ai、有 bi 个&#xff0c;权值是…

.NET Core实战项目之CMS 第十三章 开发篇-在MVC项目结构介绍及应用第三方UI

作为后端开发的我来说&#xff0c;前端表示真心玩不转&#xff0c;你如果让我微调一个位置的样式的话还行&#xff0c;但是让我写一个很漂亮的后台的话&#xff0c;真心做不到&#xff0c;所以我一般会选择套用一些开源UI模板来进行系统UI的设计。那如何套用呢&#xff1f;今天…

[FFT/IFFT]快速傅里叶(逆)变化 + 递归和递推模板

现在时间是2021-2-2&#xff0c;重新回来看2019学习的一知半解的FFTFFTFFT&#xff0c;又有了新的理解 所以修改了以往写过的文章&#xff0c;并增添些许内容 因为过去一年多&#xff0c;上了高中&#xff0c;学的知识多了些&#xff0c;以前不懂的有些东西现在看来挺简单的&am…

软件开发模式:瀑布与敏捷

瀑布和敏捷不是什么新概念&#xff0c;这里只是个人在团队合作中不得不去思考而做的归纳和总结&#xff0c;同时记录自己曾经踩过的坑&#xff0c;新瓶装旧酒&#xff0c;希望对你有所启发。瀑布模式瀑布模型是比较传统一种开发模式&#xff0c;特别是在2B的传统企业&#xff0…

.net core+Spring Cloud学习之路 一

文章开头唠叨两句。2019年了&#xff0c;而自己参加工作也两年有余了&#xff0c;用一个词来概括这两年多的生活&#xff0c;就是&#xff1a;“碌碌无为”。也不能说一点收获都没有&#xff0c;但是很少。2019来了&#xff0c;我立志要打破现状&#xff0c;改变自己&#xff0…

P3128 [USACO15DEC]Max Flow P

P3128 [USACO15DEC]Max Flow P 树上差分之点差分模板题 题目描述&#xff1a; FJ给他的牛棚的N(2≤N≤50,000)个隔间之间安装了N-1根管道&#xff0c;隔间编号从1到N。所有隔间都被管道连通了。 FJ有K(1≤K≤100,000)条运输牛奶的路线&#xff0c;第i条路线从隔间si运输到隔…

周末狂欢赛4(1-02E. JM的西伯利亚特快专递,寿司晚宴,荷马史诗)

文章目录T1&#xff1a;1-02E. JM的西伯利亚特快专递题目题解codeT2&#xff1a;寿司晚宴题目题解codeT3&#xff1a;荷马史诗题目题解codeT1&#xff1a;1-02E. JM的西伯利亚特快专递 题目 今天JM收到了一份来自西伯利亚的特快专递&#xff0c;里面装了一个字符串 s &#x…

.NET Core容器化开发系列(一)——Docker里面跑个.NET Core

前言博客园中已经有很多如何在Docker里面运行ASP.NET Core的介绍了。本篇主要介绍一些细节&#xff0c;帮助初学的朋友更加深入地理解如何在Docker中运行ASP.NET Core。安装DockerDocker现支持在主流Linux、Windows和macOS上安装&#xff0c;官方的安装文档请参考docker docs。…

中小研发团队架构实践之生产环境诊断工具WinDbg

生产环境偶尔会出现一些异常问题&#xff0c;WinDbg或GDB是解决此类问题的利器。调试工具WinDbg如同医生的听诊器&#xff0c;是系统生病时做问题诊断的逆向分析工具&#xff0c;Dump文件类似于飞机的黑匣子&#xff0c;记录着生产环境程序运行的状态。本文主要介绍了调试工具W…

多项式的基础操作(逆元/除法/取模/对数ln/开根sqrt/指数exp/快速幂)带模板+luogu全套例题

文章目录多项式的逆元理论推导模板例题&#xff1a;[luogu P4238]【模板】多项式乘法逆题目code多项式的除法/取模理论推导多项式牛顿迭代法模板例题&#xff1a;[luoguP4512]【模板】多项式除法题目code多项式对数ln理论推导模板例题题目code多项式开根sqrt理论推导模板例题题…

从软件工程的角度解读任正非的新年公开信

昨天被任正非的那封《全面提升软件工程能力与实践&#xff0c;打造可信的高质量产品》的公开信刷屏了&#xff0c;作为一个软件工程专业科班出身的软件开发从业者&#xff0c;自然是引起了我&#xff08;宝玉xp&#xff09;的好奇&#xff0c;仔细阅读之下确实让我大吃一惊&…

HttpClient在.NET Core中的正确打开方式

问题来源长期以来&#xff0c;.NET开发者都通过下面的方式发送http请求&#xff1a;using (var httpClient new HttpClient()){var response await httpClient.GetAsync(uri);//do something with response}这段代码理论上来说遵守了C#的最佳实践&#xff0c;HttpClient是IDi…

[CQOI]九连环(FFT优化+高精)

文章目录题目题解code题目 九连环是一种源于中国的传统智力游戏。 如图所示&#xff0c;九个的圆环套在一把“剑”上&#xff0c;并且互相牵连。游戏的目标是把九个圆环全部从“剑”上卸下。 圆环的装卸需要遵守两个规则 1&#xff0e;第一个&#xff08;最右边&#xff09;环…

任正非公开信:投入 20 亿美元全面提升华为软件质量

昨天&#xff0c;华为心声社区发布了来自任正非的公开信《全面提升软件工程能力与实践&#xff0c;打造可信的高质量产品》&#xff0c;信中强调从基础代码做起&#xff0c;全面提升华为软件工程能力和实践&#xff0c;其中提到一些重要举措&#xff0c;包括编码质量、架构设计…

[指数型生成函数专练]chocolate,红色病毒问题,排列组合,字串数

文章目录T1&#xff1a;chocolate题目题解codeT2&#xff1a;“红色病毒”问题题目题解codeT3&#xff1a;排列组合题目题解codeT4&#xff1a;字串数题解codeT1&#xff1a;chocolate 题目 已帮大家翻译了&#xff0c;不要去UVA或者luogu上面交&#xff0c;卡精度&#xff0…