老鼠跑的快
#include "stdafx.h"
#include "iostream"
using namespace std;
int count[1001]={0};
int path[1001]={0};
struct mouse
{
int weight,speed,id;
}mice[1001];
int cmp(const void *a,const void *b)
{
mouse *ta=(mouse*)a;
mouse *tb=(mouse*)b;
if(ta->weight==tb->weight)
return tb->speed-ta->speed;
return ta->weight-tb->weight;
}
int _tmain(int argc, _TCHAR* argv[])
{
int n=0;
count[1]=1;
cin>>n;
for(int i=2;i<n;i++)
{
for(int j=1;j<i;j++)
{
if(mice[i].weight>mice[j].weight&&mice[i].speed<mice[j].speed)
if(count[i]<count[j])
{
count[i]=count[j];
path[i]=j;
}
}
}
int max=0;
int pos;
for(int i=1;i<n;i++)
{
if(count[i]>max)
{
max=count[i];
pos=i;
}
}
cout<<"最大长度:"<<max<<endl;
system("pause");
return 0;
}