Moving On Firdaws and Fatinah are living in a country with nn cities, numbered from 11 to nn.Each city has a risk of kidnapping or robbery. Firdaws's home locates in the city uu, and Fatinah's home locates in the city vv.Now you are asked to find the…
题目链接 :https://nanti.jisuanke.com/t/26217 Description: There is a positive integer X, X's reversion count is Y. For example, X=123, Y=321; X=1234, Y=4321. Z=(X-Y)/9, Judge if Z is made up of only one number(0,1,2...9), like Z=11,Z=111,Z=222,don't cons…
//代码跑的很慢四秒会超时,结尾附两秒代码(标程) #include<bits/stdc++.h>using namespace std;typedef long long ll;const ll inf=0x3f3f3f3f;vector<pair<int,int>>tree[100010];ll dp[100010][110];/*dp[u][i]表示u节点为根的子树上选择了i个叶子节点,会经过u这个子树的边的权值和的最优值.转移方程如下:dp[u][i]=min(…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6281 题意: 根据已给出的式子,进行排序,然后输出排完序后原先的下表. 题解:用结构体保存,在用结构体排序,利用stable_sort()稳定排序.因为会爆long long ,所以对式子进行转换. 代码: #include<bits/stdc++.h> using namespace std; struct node{ int n; long long a,b,c; friend bool op…