#include<iostream> #include<vector> #include<algorithm> #include<stack> #define N 10010 using namespace std; vector<long int> head[N]; stack<long int> way; long int n; bool visited[N][N]; bool vis[N]; long long int d[N]…
#include<iostream> #include<vector> #include<algorithm> #include<stack> #define N 10010 using namespace std; vector<long int> head[N]; stack<long int> way; long int n; bool visited[N][N]; bool vis[N]; long long int d[N]…
624 - CD 题意:一段n分钟的路程,磁带里有m首歌,每首歌有一个时间,求最多能听多少分钟的歌,并求出是拿几首歌. 思路:如果是求时常,直接用01背包即可,但设计到打印路径这里就用一个二维数组标记一下即可. const int N=1e3+10; int n,m,a[N],d[N],v[N][N]; int main() { while(~scanf("%d%d",&n,&m)) { memset(v,0,sizeof(v)); memset(d,0,sizeof(…
题目链接: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=995 Problem D: The Necklace My little sister had a beautiful necklace made of colorful beads. Two successive beads in the necklace shared a c…
FatMouse believes that the fatter a mouse is, the faster it runs. To disprove this, you want to take the data on a collection of mice and put as large a subset of this data as possible into a sequence so that the weights are increasing, but the speed…