![](https://img-blog.csdnimg.cn/20201014180756724.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
模版
墨蘅
这个作者很懒,什么都没留下…
展开
-
☀L2-001 紧急救援 (25分)[PTA][dijstra最短路][带权的最短路径条数]
作为一个城市的应急救援队伍的负责人,你有一张特殊的全国地图。在地图上显示有多个分散的城市和一些连接城市的快速道路。每个城市的救援队数量和每一条连接两个城市的快速道路长度都标在地图上。当其他城市有紧急求助电话给你的时候,你的任务是带领你的救援队尽快赶往事发地,同时,一路上召集尽可能多的救援队。输入格式:输入第一行给出4个正整数N、M、S、D,其中N(2≤N≤500)是城市的个数,顺便假设城市的编号为0 ~(N−1);M是快速道路的条数;S是出发地的城市编号;D是目的地的城市编号。第二行给出N个正.原创 2020-11-23 11:40:08 · 112 阅读 · 0 评论 -
☀L2-013 红色警报 (25分)[PTA][并查集]
战争中保持各个城市间的连通性非常重要。本题要求你编写一个报警程序,当失去一个城市导致国家被分裂为多个无法连通的区域时,就发出红色警报。注意:若该国本来就不完全连通,是分裂的k个区域,而失去一个城市并不改变其他城市之间的连通性,则不要发出警报。输入格式:输入在第一行给出两个整数N(0<N≤500)和M(≤5000),分别为城市个数(于是默认城市从0到N-1编号)和连接两城市的通路条数。随后M行,每行给出一条通路所连接的两个城市的编号,其间以1个空格分隔。在城市信息之后给出被攻占的信息,...原创 2020-10-08 11:44:07 · 181 阅读 · 0 评论 -
B.Basic GCD Problem[打表][优化最大质因子][优化快速幂]or[素数筛][质因子分解]
As a great ACMer, ZYB is also good at math and number theory.ZYB constructs a functionfc(x)fc(x)such that:As a great ACMer, ZYB is also good at math and number theory.ZYB constructs a functionfc(x)fc(x)such that:.Give some positi...原创 2020-07-24 15:09:14 · 89 阅读 · 0 评论 -
H.ProblematicPublicKeys[欧拉素数筛][stl][vector][一维数组去重][unique函数][erase函数]
欧拉素数筛:ll prime[100010];bool vis[100010];void init(){ memset (vis,true,sizeof (vis)); vis[1]=false; int cnt=0; for (int i=2; i<100000; i++) { if (vi...原创 2020-04-25 18:00:54 · 372 阅读 · 0 评论 -
Snail in Matrix[矩阵的螺旋输出][顺时针螺旋输出]
Given a two-dimensional matrix, your program is to print the matrix elements in a "snail-like" fashion as follows:print elements in the first row from left to right on an output line print eleme...原创 2020-04-23 22:15:53 · 166 阅读 · 0 评论 -
Beer Barrels[CTU Open Contest 2019][组合数][取模快速幂][位运算]
Finally, you got into the cellar of your preferred brewery where you expected many large piles ofbeer barrels to be stored. You are eager to inspect the barrels and maybe even their content (alot and ...原创 2020-04-23 20:40:09 · 270 阅读 · 0 评论