YONEX @ 2024-07-30 11:15:46
RT,CE,不知道错在哪了,拜谢,玄关
#include<bits/stdc++.h>
using namespace std;
int a[5005];
int end[5005];
int ans=0;
int n;
inline void longest(int k)
{
if(k>end[ans])
{
end[++ans]=k;
return;
}
else
{
for(int i=1;i<=ans;i++)
if(end[i]>=k){end[i]=k;break;}
return;
}
}//最长上升子序列
int main()
{
cin>>n;
end[0]=-1;
for(int i=1;i<=n;i++)
{
cin>>a[i];
longest(a[i]);
}
cout<<ans;
return 0;
}
by Ivan422 @ 2024-07-30 11:17:12
end 是关键字。
by LengYanCxl @ 2024-07-30 11:21:19
不能用end做变量名称,是关键字
by YONEX @ 2024-07-30 11:27:44
@LengYanCxl @Ivan422 拜谢,一关,此贴结
by _Timeless_ @ 2024-07-31 10:08:12
%%%% @love_nn
by yujiahaoa @ 2024-08-04 10:00:11
@love_nn 呼叫gengen队