20分求助
查看原帖
20分求助
264463
添哥楼主2021/8/10 19:52
#include<iostream>
using namespace std;
int main()
{
	int t;
	cin>>t;
	while(t--)
	{
		int n;
		cin>>n;
		bool s[n+1];
		double h[n+1];
		int a=0,b=0;
		double h1[n+1],h2[n+1];
		for(int i=1;i<=n;i++)
		{
			cin>>s[i];
		}
		for(int i=1;i<=n;i++)
		{
			cin>>h[i];
			if(!s[i])
			{
				a++;
				h1[a]=h[i];
			}
			else
			{
				b++;
				h2[b]=h[i];
			}
		}
		for(int i=1;i<=a;i++)
		{
			cout<<h1[i]<<" ";
		}
		cout<<endl;
		for(int i=1;i<=b;i++)
		{
			cout<<h2[i]<<" ";
		}
		cout<<endl;
	}
	return 0;
}

蒟蒻连YNOI都切不掉了

2021/8/10 19:52
加载中...