
vjudge
文章平均质量分 92
飞来飞去y
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
Booking System(贪心)
Booking System CodeForces - 416CInnovation technologies are on a victorious march around the planet. They integrate into all spheres of human activity!A restaurant called “Dijkstra’s Place” has sta...原创 2018-11-13 20:05:40 · 454 阅读 · 0 评论 -
Flight hdu3499
这个题真的是做的我很难受,就是从开始sa的点搜一次,找到它到每个点的最短路dis1[I],再从终点sb搜一次,找到它到每个点的最短路dis[I],我建立了两个图,因为是单向的。搜完两次之后,再枚举所有的路,假设其中一个是从a到b,权值为w,则dis1[a]+dis2[b]+w/2就是始点sa到终点sb,把优惠券用到a到b这条路上的结果ans。循环m次,就能得到一个最小值。下面是AC代码:...原创 2018-11-25 16:55:54 · 204 阅读 · 0 评论 -
I love sneakers! HDU - 3033
分组背包的问题,一开始没想到,看到有个大佬写的挺好的,他是这样写的:分组背包问题,大意**要买鞋,有k种牌子,每种牌子至少买一双鞋子。每双鞋子有标价跟实际价值。求用m多的钱买最多价值的鞋。其实我觉得这题的难点就在处理“至少”这点上面。状态方程很多都能推出用 dp[k][m] 来表示 已经买了k种鞋 在有m钱状态下的 鞋的最大价值。状态转移方程为 for( k = 1 ; k <...转载 2018-11-18 10:40:04 · 190 阅读 · 0 评论 -
ACboy needs your help
ACboy has N courses this term, and he plans to spend at most M days on study.Of course,the profit he will gain from different course depending on the days he spend on it.How to arrange the M days for ...原创 2018-11-17 21:30:11 · 151 阅读 · 0 评论 -
CodeForces - 987 C.Three displays
这是思维题吗,用的动归的的#include<iostream>#include<algorithm>#include<cstdio>#include<cstring>#include<math.h>using namespace std;#define INF 1e9+5struct node{ int s,c;...原创 2018-11-17 21:28:02 · 321 阅读 · 0 评论 -
Cash Machine POJ - 1276
的用二进制思想进行优化,要不然会tl#include<iostream>#include<algorithm>#include<cstdio>#include<cstring>#include<math.h>using namespace std;#define N 1e9+5int w[10005],dp[100005]...原创 2018-11-17 21:22:05 · 229 阅读 · 0 评论 -
HDU Today HDU - 2112
用的map映射为整数,后面就和普通的最短路一样的,注意头文件。#include<iostream>#include<cstdio>#include<cstring>#include<cmath>#include<algorithm>#include<stack>#include<queue>#inc原创 2018-11-24 11:49:59 · 175 阅读 · 0 评论 -
地,颜色与
链接:https://ac.nowcoder.com/acm/contest/218/A来源:牛客网现在,你作为一名新星鹏洛客,找到了一块绝佳的修炼地。这块地方可以被描述成一个 n x m 的矩形。你已经在这块地中的一些位置打好了标记。接下去,就该对整块地赋予你的颜色了。一个位置能被赋予你的颜色,当且仅当满足以下条件之一: 1. 这个位置被打上了标记。 2. 这个位置在不经过被...原创 2018-11-17 12:37:15 · 200 阅读 · 0 评论 -
最短路堆优化
MPI Maelstrom POJ - 1502 用不着堆优化也能过,就是想练一下手,上个题的最短路用堆优化过不了,求大佬解答#include&lt;iostream&gt;#include&lt;cstdio&gt;#include&lt;cstring&gt;#include&lt;cmat原创 2018-11-23 20:45:39 · 342 阅读 · 0 评论 -
数塔 HDU - 2084
数塔问题,dp,我从上往下推的,貌似从下往上推更简单。#include<iostream>#include<cstdio>#include<algorithm>#include<cstring>using namespace std;int main(){ int c; scanf("%d",&c); w...原创 2018-11-14 20:32:29 · 256 阅读 · 0 评论 -
Max Sum HDU - 1003
这个题有个分治的想法是o(nlogn),动态规划的想法是o(n),用动态规划就好了,一开始总是wa,是那个位置标记错了,当最大值变的时候再改变开始位置和最终位置。#include<iostream>#include<cstdio>#include<algorithm>#include<cstring>using namespace std;...原创 2018-11-14 19:57:35 · 132 阅读 · 0 评论 -
最大公约数GCD(51Nod - 1011)
直接用__gcd()就能过,头文件是algorithm.#include<bits/stdc++.h>using namespace std;int main(){ long long a,b,c; cin>>a>>b; c=__gcd(a,b); cout<<c<<endl;}...原创 2018-11-14 18:54:20 · 226 阅读 · 0 评论 -
Raising Modulo Numbers(poj1995)
大水题,直接快速幂#include<iostream>#include<cstdio>using namespace std;int ksm(int a,int b,int m){ a=a%m; int ans=1; while(b>0){ if(b&1){ans=(ans*a)%m;} a=(...原创 2018-11-14 18:37:19 · 153 阅读 · 0 评论 -
Tri Tiling (poj2663)
DescriptionInhow many ways can you tile a 3xn rectangle with 2x1 dominoes?Here is a sample tiling of a 3x12 rectangle.InputInput consists of several test cases followed by a line containing -1. Ea...原创 2018-11-13 21:55:13 · 190 阅读 · 0 评论 -
Pie (poj3122)
DescriptionMy birthday is coming up and traditionally I’m serving pie. Not just one pie, no, I have a number N of them, of various tastes and of various sizes. F of my friends are coming to my party ...原创 2018-11-13 20:55:47 · 291 阅读 · 1 评论 -
Array Product (CodeForces - 1042C )
Array ProductYou are given an array aa consisting of nn integers. You can perform the following operations with it:Choose some positions ii and jj (1≤i,j≤n,i≠j1≤i,j≤n,i≠j), write the value of ai⋅aja...原创 2018-11-13 20:39:19 · 190 阅读 · 0 评论 -
Til the Cows Come Home POJ - 2387
这个题可以不用堆优化,写个模板。我不明白为什么加一个book数组标记一下就会wa,不加标记就ac,求大佬解答。#include<iostream>#include<algorithm>#include<queue>#include<stack>#include<map>#include<vector>#incl...原创 2018-11-25 12:06:18 · 138 阅读 · 0 评论