ural 1273. Tie】的更多相关文章

1273. Tie Time limit: 1.0 secondMemory limit: 64 MB The subway constructors are not angels. The work under the ground and… Well, they are not angels. And where have you seen angels? It is all in a lifetime! Show me first somebody who has never… and t…
1741. Communication Fiend Time limit: 1.0 second Memory limit: 64 MB Kolya has returned from a summer camp and now he's a real communication fiend. He spends all his free time on the Web chatting with his friends via ICQ. However, lately the protocol…
F - The Great TeamTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hust.edu.cn/vjudge/contest/view.action?cid=87643#problem/F Description When a few students of the Ural State University finished their sport career, the university encountered…
C - Anniversary FireworkTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hust.edu.cn/vjudge/contest/view.action?cid=87643#problem/B Description Denis has to prepare the Ural State University 90th anniversary firework. He bought n rockets and s…
URAL 1741 思路: dp 状态:dp[i][1]表示到第i个版本为正版的最少流量花费 dp[i][0]表示到第i个版本为盗版的最少流量花费 初始状态:dp[1][0]=dp[0][0]=0 目标状态:min(dp[n][0],dp[n][1]) 状态转移:见代码,注意如果是cracked版本,如果原来是盗版,转移后还是盗版 代码: #include<bits/stdc++.h> using namespace std; #define ll long long #define mem(…
URAL 1501 思路: dp+记忆化搜索 状态:dp[i][j]表示选取第一堆前i个和第二堆前j的状态:0:0多1个              1:0和1相等                2:1多一个         -2:不能达到题目所描述的状态 初始状态:dp[0][0]=1 状态转移:见代码 代码: #include<bits/stdc++.h> using namespace std; #define ll long long #define pb push_bck #defin…
URAL 1029 思路: dp+记录路径 状态:dp[i][j]表示到(i,j)这个位置为止的最少花费 初始状态:dp[1][i]=a[1][i](1<=i<=m) 状态转移:dp[i][j]=a[i][j]+max(dp[i-1][j],dp[i][j-1],dp[i][j+1])(注意扫的方向不同) 数组记录上一次的坐标,最后递归输出 代码: #include<bits/stdc++.h> using namespace std; #define ll long long #…
URAL 1658 思路: dp+记录路径 状态:dp[i][j]表示s1为i,s2为j的最小位数 初始状态:dp[0][0]=0 状态转移:dp[i][j]=min(dp[i-k][j-k*k]+1,dp[i][j])(0<=k<10) 在状态转移时用一个数组v[i][j]记录选的k 代码: #include<bits/stdc++.h> using namespace std; #define ll long long #define pb push_back #define…
URAL 1303 思路: dp+贪心,然后记录路径 mx[i]表示从i开始最大可以到的位置 sufmx[i]表从1-i的某个位置开始最大可以到达的位置 比普通的贪心效率要高很多 代码: #include<bits/stdc++.h> using namespace std; #define ll long long #define pb push_back #define mp make_pair #define pii pair<int,int> #define mem(a,b…
URAL 1183 思路:区间dp,打印路径,详见http://www.cnblogs.com/widsom/p/8321670.html 代码: #include<iostream> #include<cstdio> #include<cstring> #include<string> #include<cmath> #include<algorithm> using namespace std; #define ll long l…