自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(53)
  • 收藏
  • 关注

原创 英雄装备激活模拟器

Clang。

2023-07-21 21:30:51 67

原创 codeforces1165E Two Arrays and Sum of Functions

https://codeforces.com/contest/1165/problem/E You are given two arraysaaandbb, both of lengthnn. Let's define a functionf(l,r)=∑l≤i≤rai⋅bif(l,r)=∑l≤i≤rai⋅bi. Your task is to reorder the elemen...

2019-05-24 22:15:07 251

原创 CF999E Reachability from the Capital dfs graph greedy

There arencities andmmroads in Berland. Each road connects a pair of cities. The roads in Berland are one-way. What is the minimum number of new roads that need to be built to make all the cities...

2019-05-08 23:11:52 286

原创 CF 1092E - Minimal Diameter Forest 构造算法,贪心,树,搜索

You are given a forest — an undirected graph withnnvertices such that each its connected component is a tree. The diameter (aka "longest shortest path") of a connected undirected graph is the maxim...

2019-05-07 19:30:41 336

原创 Two Merged Sequences CodeForces - 1144G

Two Merged Sequences Two integer sequences existed initially, one of them wasstrictlyincreasing, and another one —strictlydecreasing. Strictly increasing sequence is a sequence of integers[x1&...

2019-04-14 21:45:34 143

原创 平面最小距离对问题 分治算法

详细的讲解戳这儿https://blog.csdn.net/qq_40707370/article/details/85268256?tdsourcetag=s_pcqq_aiomsg #include<bits/stdc++.h> using namespace std; const int INF = 0x3fffffff; int n; struct Point { ...

2019-04-14 12:15:17 290

原创 UVA 11988 模拟链表

You’re typing a long text with a broken keyboard. Well it’s not so badly broken. The only problem with the keyboard is that sometimes the “home” key or the “end” key gets automatically pressed (intern...

2019-04-08 18:53:51 84

原创 CF1108F MST Unification

You are given an undirected weightedconnectedgraph withnnvertices andmmedgeswithout loops and multiple edges. Theii-th edge isei=(ui,vi,wi)ei=(ui,vi,wi); the distance between verticesuiuia...

2019-04-06 21:57:37 201

原创 Codeforces 1108E2 Array and Segments (Hard version) 线段树 极差

You are given an array a consisting of n integers. The value of the i-th element of the array is ai. You are also given a set of m segments. The j-th segment is [lj;rj], where 1≤lj≤rj≤n. You can cho...

2019-04-06 21:04:49 185

原创 背包九讲 解题报告

原文: https://blog.csdn.net/ling_du/article/details/41594767 Bone Collector HDU 2602 http://acm.hdu.edu.cn/showproblem.php?pid=2602 经典的01背包题,给出了石头的数量与背包的容量,然后分别给出每个石头的容量与价值,要求最优解 #include<b...

2019-03-20 13:25:43 160

原创 UVA1596 - Bug Hunt

In this problem, we consider a simple programming language that has only declarations of onedimensional integer arrays and assignment statements. The problem is to find a bug in the given program. The...

2019-03-14 18:24:12 245

原创 UVA-230 Borrowers 模拟

Like Mr. Lamb, librarians have their problems with borrowers too. People don’t put books back where they should. Instead, returned books are kept at the main desk until a librarian is free to replace ...

2019-03-12 20:46:58 100

原创 CSU-2007 Football Training Camp

Football Training Camp 在一次足球联合训练中一共有n支队伍相互进行了若干场比赛。 对于每场比赛,赢了的队伍得3分,输了的队伍不得分,如果为平局则两支队伍各得1分。 Input 输入包含不超过1000组数据。 每组数据的第一行为一个整数n(2 ≤ n ≤ 20),第二行为n个整数s1, s2, …, sn(0 ≤ si ≤ 200, 1 ≤ i ≤ n),即各个队伍目前的得...

2019-03-11 20:21:46 293

转载 CSU 2125小Z的培养皿(并查集)

感谢大佬https://blog.csdn.net/qq_36258516/article/details/80500815 Description 小Z高中的时候特别喜欢生物,在一次做实验的过程中,小Z配置了n个培养皿,每个培养皿中有着若干种类的细菌,但由于实验室的培养皿数量有限,老师要求小Z尽可能少地使用培养皿。为此,小Z只得将一些培养皿进行混合,但由于一些生物上的特殊要求,只有含有相同细...

2019-03-11 16:29:53 192

原创 UVA 1595对称轴 set集合

The figure shown on the left is left-right symmetric as it is possible to fold the sheet of paper along a vertical line, drawn as a dashed line, and to cut the figure into two identical halves. The fi...

2019-03-08 15:25:22 168

原创 UVA 1594 vector的集合与相等运算符

A Ducci sequence is a sequence of n-tuples of integers. Given an n-tuple of integers (a1, a2, · · · , an), the next n-tuple in the sequence is formed by taking the absolute differences of neighboring ...

2019-03-07 19:36:24 120

原创 UVA 1593 代码对齐

You are working in a team that writes Incredibly Customizable Programming Codewriter (ICPC) which is basically a text editor with bells and whistles. You are working on a module that takes a piece of ...

2019-03-06 17:32:17 175

原创 POJ3126 搜索

#include &lt;iostream&gt; #include &lt;queue&gt; #include&lt;cstring&gt; using namespace std; #define MAX_N 9999 + 16 int prime[MAX_N]; // 第i个素数 bool is_prime[MAX_N + 1]; //is_prime[i]为真的时候表示i...

2019-03-04 08:31:59 183

原创 HDU 1272 并查集

Problem Description 上次Gardon的迷宫城堡小希玩了很久(见Problem B),现在她也想设计一个迷宫让Gardon来走。但是她设计迷宫的思路不一样,首先她认为所有的通道都应该是双向连通的,就是说如果有一个通道连通了房间A和B,那么既可以通过它从房间A走到房间B,也可以通过它从房间B走到房间A,为了提高难度,小希希望任意两个房间有且仅有一条路径可以相通(除非走了回头路)。...

2019-03-01 15:26:03 98

原创 HDU 1213并查集入门题

#include&lt;cstdio&gt; #include&lt;cstring&gt; using namespace std; const int maxn=1000+5; int pa[maxn]; void init(int n){ for(int i=0;i&lt;=n;i++) pa[i]=i; } int findset(int x){ ...

2019-02-28 15:41:18 118

原创 POJ 1182 并查集模板

以下是并查集模板: #include<cstdio> #include<cstring> #include<algorithm> using namespace std; const int maxn = 100000 + 5; int par[maxn];int rankk[maxn]; void init(int n) { for (int i = ...

2019-02-26 19:13:19 106

原创 HDU 1166 敌兵布阵 线段树,树形数组

Problem Description C国的死对头A国这段时间正在进行军事演习,所以C国间谍头子Derek和他手下Tidy又开始忙乎了。A国在海岸线沿直线布置了N个工兵营地,Derek和Tidy的任务就是要监视这些工兵营地的活动情况。由于采取了某种先进的监测手段,所以每个工兵营地的人数C国都掌握的一清二楚,每个工兵营地的人数都有可能发生变动,可能增加或减少若干人手,但这些都逃不过C国的监视。 ...

2019-02-25 12:45:14 129

原创 POJ1009-Edge Detection

 全解题报告索引目录 -&gt; 【北大ACM – POJ试题分类】 转载请注明出处:http://exp-blog.com/2018/06/25/pid-1141/ ------------------------------------------------------------------------- 大致题意: 某种卫星使用一种叫做“run length encoding”的方...

2019-02-17 17:13:02 136

原创 POJ 1001 高精度幂 JAVA

Sample Input 95.123 12 0.4321 20 5.1234 15 6.7592 9 98.999 10 1.0100 12 Sample Output 548815620517731830194541.899025343415715973535967221869852721 .00000005148554641076956121994511276767154838...

2019-01-22 03:01:58 128

原创 初探JAVA 00 面向对象和idea的使用

方法: public class Main { public static void main(String[] args){ System.out.println(sum(1,2,3)); int a[]=new int [50]; fill(a,99); System.out.println(a[49]); ...

2019-01-16 20:30:48 212

原创 UVA 1374 Power Calculus 迭代加深

给出 n,问至少需要计算几步得到 x^n 每次总使用最新得到的那个数字即a[d]进行搜索 #include&lt;cstdio&gt; #include &lt;algorithm&gt; using namespace std; int a[30],n; bool dfs(int d,int maxd){ if(a[d]==n) return true; if(d==m...

2019-01-14 23:22:55 100

原创 UVA 1343 The Rotation Game IDA*

使用IDA*的思想解题, 主要的难点在于如何模拟Rotate操作,以及在检查终点和启发函数时检测中心的8个方格数字是否相同 #include &lt;cstdio&gt; #include &lt;algorithm&gt; using namespace std; /* 方格编号 00 01 02 03 04 05 06 07 08 09 10 ...

2019-01-14 17:33:03 118

原创 UVA 12325 Zombie's Treasure Chest 分类枚举算法

所给数据在int范围内  单独使用其中一种枚举算法都会导致TLE #include&lt;cstdio&gt; #include&lt;algorithm&gt; using namespace std; typedef long long LL; int main(){ int T; scanf("%d", &amp;T); for(int kase = 1; kase &l...

2019-01-04 15:31:14 120

原创 UVA11212 编辑书稿 IDA*

  #include &lt;cstdio&gt; #include &lt;cstring&gt; using namespace std; const int maxn=9; int n,a[maxn]; bool is_sorted(){ for(int i=0;i&lt;n-1;i++) if(a[i]+1!=a[i+1]) return false; ...

2019-01-02 20:03:49 223

原创 埃及分数问题 迭代加深搜索

  给出一个真分数a/b,使用单位分数的和(1/a,a是自然数),拆分的少的比拆分的多的好  拆分的分数相同情况下 ,最小的分数越大越好 #include&lt;cstdio&gt; #include&lt;cstring&gt; #include&lt;iostream&gt; #include&lt;algorithm&gt; using namespace std; int a, b...

2018-12-29 14:02:17 259

原创 UVA1601 POJ 3523 状态压缩 预处理图 分别使用单向双向BFS和A*搜索

Description You are working for an amusement park as an operator of an obakeyashiki, or a haunted house, in which guests walk through narrow and dark corridors. The house is proud of their lively gho...

2018-12-26 15:56:19 339 1

原创 UVA10603 倒水问题BFS

使用类似dijkstra的方式求解   #include &lt;cstdio&gt; #include &lt;cstring&gt; #include &lt;queue&gt; #include &lt;algorithm&gt; using namespace std; const int maxn=200+5; int vis[maxn][maxn],cap[3],ans[maxn...

2018-12-25 09:35:20 252

原创 八数码问题 数组模拟队列bfs 链表哈希涵数判重

在BFS的时候使用链表实现的哈希表记录vis判重 sample input: 2 6 4 1 3 7 0 5 8 8 1 5 7 3 6 4 0 2  sample output: 31 无法到达目标局面输出 -1 #include &lt;iostream&gt; #include &lt;cstdio&gt; #include &lt;cstring&gt; using name...

2018-12-24 14:33:48 251

原创 UVA1354 天平难题 枚举子集

对如何选择该层的最大宽度作了一个丑丑的图解 #include&lt;cstdio&gt; #include&lt;cstring&gt; #include&lt;vector&gt; #include&lt;iostream&gt; using namespace std; struct Tree { double L, R; // distance from the root to...

2018-12-22 14:07:17 197

原创 hdu1230 大数加法+进制转换

Problem Description 读入两个不超过25位的火星正整数A和B,计算A+B。需要注意的是:在火星上,整数不是单一进制的,第n位的进制就是第n个素数。例如:地球上的10进制数2,在火星上记为“1,0”,因为火星个位数是2进制的;地球上的10进制数38,在火星上记为“1,1,1,0”,因为火星个位数是2进制的,十位数是3进制的,百位数是5进制的,千位数是7进制的…… Input ...

2018-12-06 15:32:01 119

原创 矩阵快速幂

POJ 3070: Description In the Fibonacci integer sequence, F0 = 0, F1 = 1, and Fn = Fn − 1 + Fn − 2 for n ≥ 2. For example, the first ten terms of the Fibonacci sequence are: 0, 1, 1, 2, 3, 5, 8, 13,...

2018-12-05 12:40:06 127

原创 hdu1466计算直线的交点数

平面上有n条直线,且无三线共点,问这些直线能有多少种不同交点数。 比如,如果n=2,则可能的交点数量为0(平行)或者1(不平行)。 首先将n条直线分成两部分,第一部分j条直线互相全部两两平行,第二部分n-j条直线与第一部分不平行。 总的交点数=第二部分的交点数+两个部分之间的交点数,其中第二部分的交点数是原问题的子问题,两部分之间的交点数=两部分直线数量的乘积 于是 m[n] = m[i]+...

2018-12-04 17:03:30 215

原创 九余数定理

hdu1013 Digital Roots The digital root of a positive integer is found by summing the digits of the integer. If the resulting value is a single digit then that digit is the digital root. If the result...

2018-12-03 13:13:36 732

原创 hdu1018 斯特林公式

Input Input consists of several lines of integer numbers. The first line contains an integer n, which is the number of cases to be tested, followed by n lines, one integer 1 ≤ n ≤ 107 on each line. ...

2018-12-03 11:41:52 131

原创 HDU1166 二叉索引树

Input 第一行一个整数T,表示有T组数据。 每组数据第一行一个正整数N(N&lt;=50000),表示敌人有N个工兵营地,接下来有N个正整数,第i个正整数ai代表第i个工兵营地里开始时有ai个人(1&lt;=ai&lt;=50)。 接下来每行有一条命令,命令有4种形式: (1) Add i j,i和j为正整数,表示第i个营地增加j个人(j不超过30) (2)Sub i j ,i和j为正整数,...

2018-12-02 19:33:37 81

英雄装备激活模拟器Clang

英雄装备激活模拟器Clang

2023-07-21

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除