还是只会4道。。sad。。。
A:SwapSort
用一个数组存储排好序之后。然后从头开始依次将需要交换的与本来应该在这个位置的交换,最多交换n-1次。
代码如下;
#include <iostream>#include <cstdio>#include <string>#include <cstring>#include <stdlib.h>#include <math.h>#include <ctype.h>#include <queue>#include <map>#include <set>#include <algorithm>using namespace std;int a[4000], b[4000], c[4000], d[4000];int main(){ int i, j, n, pos, cnt; while(scanf("%d",&n)!=EOF) { cnt=0; for(i=0;i<n scanf b sort for if pos="j;" break swap c printf return> <br> B: BerSU Ball <p></p> <p>二分图最大匹配裸题。</p> <p>代码如下:</p> <p></p> <pre name="code" class="sycode">#include <iostream>#include <cstdio>#include <string>#include <cstring>#include <stdlib.h>#include <math.h>#include <ctype.h>#include <queue>#include <map>#include <set>#include <algorithm>using namespace std;int link[200], vis[200], n, m, a[200], b[200];int head[200], cnt;struct node{ int u, v, next;}edge[100000];void add(int u, int v){ edge[cnt].v=v; edge[cnt].next=head[u]; head[u]=cnt++;}int dfs(int u){ int i; for(i=head[u];i!=-1;i=edge[i].next) { int v=edge[i].v; if(!vis[v]) { vis[v]=1; if(link[v]==-1||dfs(link[v])) { link[v]=u; return 1; } } } return 0;}void hungary(){ int i, ans=0; memset(link,-1,sizeof(link)); for(i=0;i<n memset if ans printf main int i j while for scanf cnt="0;" add hungary return> <br> C: Given Length and Sum of Digits... <p></p> <p>贪心水题。</p> <p>按照顺序依次填充。</p> <p>代码如下:</p> <p></p> <pre name="code" class="sycode">#include <iostream>#include <cstdio>#include <string>#include <cstring>#include <stdlib.h>#include <math.h>#include <ctype.h>#include <queue>#include <map>#include <set>#include <algorithm>using namespace std;#define LL __int64const int INF=0x3f3f3f3f;int a[1000], b[1000];int main(){ int m, s, i, j, x; while(scanf("%d%d",&m,&s)!=EOF) { if(m*9<s printf continue if else x="s-1;" for i>=2; i--) { if(x>=9) { a[i]=9; x-=9; } else if(x>=0&&x=9) { b[i]=9; x-=9; } else if(x>=0&&x <br> D: Unbearable Controversy of Being </s><p></p> <p>枚举起点,分别进行BFS找到距离为2的点,然后记录到达这个点的次数,若次数大于2,说明存在,根据组合数来求解。</p> <p>代码如下:</p> <p></p> <pre name="code" class="sycode">#include <iostream>#include <cstdio>#include <string>#include <cstring>#include <stdlib.h>#include <math.h>#include <ctype.h>#include <queue>#include <map>#include <set>#include <algorithm>using namespace std;#define LL __int64LL vis[4000], ans;int head[4000], cnt, n;struct node{ int u, v, next;}edge[50000];void add(int u,int v){ edge[cnt].v=v; edge[cnt].next=head[u]; head[u]=cnt++;}void bfs(int x){ int i; queue<int>q; for(i=head[x];i!=-1;i=edge[i].next) { q.push(edge[i].v); } while(!q.empty()) { int u=q.front(); q.pop(); for(i=head[u];i!=-1;i=edge[i].next) { int v=edge[i].v; if(v!=x) vis[v]++; } } for(i=1;i=2) ans+=vis[i]*(vis[i]-1)/2; }}int main(){ int m, i, j, u, v; scanf("%d%d",&n,&m); ans=0; memset(head,-1,sizeof(head)); cnt=0; while(m--) { scanf("%d%d",&u,&v); add(u,v); } for(i=1;i <br> <br> <p></p> </int></algorithm></set></map></queue></ctype.h></math.h></stdlib.h></cstring></string></cstdio></iostream>

htmlisaspecifictypefodyfocusedonstructuringwebcontent,而“代码” badlyLyCludEslanguagesLikeLikejavascriptandPytyPythonForFunctionality.1)htmldefineswebpagertuctureduseTags.2)“代码”代码“ code” code code code codeSpassSesseseseseseseseAwiderRangeLangeLangeforLageforLogageforLogicIctInterract

HTML、CSS和JavaScript是Web开发的三大支柱。1.HTML定义网页结构,使用标签如、等。2.CSS控制网页样式,使用选择器和属性如color、font-size等。3.JavaScript实现动态效果和交互,通过事件监听和DOM操作。

HTML定义网页结构,CSS负责样式和布局,JavaScript赋予动态交互。三者在网页开发中各司其职,共同构建丰富多彩的网站。

HTML适合初学者学习,因为它简单易学且能快速看到成果。1)HTML的学习曲线平缓,易于上手。2)只需掌握基本标签即可开始创建网页。3)灵活性高,可与CSS和JavaScript结合使用。4)丰富的学习资源和现代工具支持学习过程。

AnexampleOfAstartingTaginHtmlis,beginSaparagraph.startingTagSareEssentialInhtmlastheyInitiateEllements,defiteTheeTheErtypes,andarecrucialforsstructuringwebpages wepages webpages andConstructingthedom。

如何设计菜单中的虚线分割效果?在设计菜单时,菜名和价格的左右对齐通常不难实现,但中间的虚线或点如何...

网页代码编辑器中的HTML元素分析许多在线代码编辑器允许用户输入HTML、CSS和JavaScript代码。最近,有人提出了一...

关于使用react-app-rewired构建静态页面时如何避免代码压缩许多开发者在使用React构建静态页面时,希望在交付给�...


热AI工具

Undresser.AI Undress
人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover
用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool
免费脱衣服图片

Clothoff.io
AI脱衣机

AI Hentai Generator
免费生成ai无尽的。

热门文章

热工具

安全考试浏览器
Safe Exam Browser是一个安全的浏览器环境,用于安全地进行在线考试。该软件将任何计算机变成一个安全的工作站。它控制对任何实用工具的访问,并防止学生使用未经授权的资源。

SublimeText3 Mac版
神级代码编辑软件(SublimeText3)

Atom编辑器mac版下载
最流行的的开源编辑器

SublimeText3 英文版
推荐:为Win版本,支持代码提示!

记事本++7.3.1
好用且免费的代码编辑器