全部re,不知道为什么
查看原帖
全部re,不知道为什么
1089582
HIT2023112282楼主2024/1/17 20:04
#include<bits/stdc++.h>
using namespace std;
int a[110];
int main()
{
	int M,N,sum=0,b,t;
	for(int i=1;i<=M;i++)
	{
		a[i]=-1;
	}
	cin>>M>>N;
	for(int i=1;i<=N;i++)
	{
		cin>>b;
		t=1;
		for(int j=1;j<=M;j++)
		{
			if(b==a[j])
			{
				t=0;
			}
		}
		sum+=t;
		if(t==1)
		{
			for(int j=1;j<=M-1;j++)
			{
				a[j]=a[j+1];
			}
			a[M]=b;
		}
	}
	cout<<sum;
}
2024/1/17 20:04
加载中...