UOJ Logo

NOI.AC

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#146839#8. 小w、小j和小z1865728205507ms1312kbC++1.3kb2022-03-06 12:03:392022-03-06 12:03:41

answer

#include<bits/stdc++.h>
using namespace std;
int n,m,t,k;
vector<int> sushu,res;
bool no_sushu[1001];
bool check_ou(int x)
{
	int cnt=0;
	for(int i=1,j=1;j<=n;++j,i*=10)
	{
		int t1=x/i;
		t1%=(i*10);
		if((t1&1)==0)
		{
			cnt++;
		}
		if(cnt>m)
		{
			return false;
		}
	}
	if(cnt==m)
	{
		return true;
	}
	else{
		return false;
	}
}
bool cheack_yin(int x)
{
	int cnt=0,t1=1;
	for(int i=0;i<sushu.size();++i)
	{
		int c2=0;
		if(x%sushu[i]==0)
		{
			cnt++;
		}
		while(x%sushu[i]==0)
		{
			x/=sushu[i];
			c2++;
		}
		if(c2>1)
		{
			t1*=(c2+1);
			cnt--;
		}
	}
	if(t1*(1<<cnt)==k)
	{
		return true;
	}
	else
	{
		return false;
	}
}
int main()
{
	for(int i=2;i<=1001;++i)
	{
		if(no_sushu[i])
		{
			continue;
		}
		for(int j=i*2;j<=1001;j+=i)
		{
			no_sushu[j]=true;
		}
	}
	for(int i=2;i<=1001;++i)
	{
		if(no_sushu[i]==false)
		{
			sushu.push_back(i);
		}
	}
	cin>>t;
	while(t--){
		res.clear();
		//TODO
		int t1;
		cin>>n>>m>>k;
		if(n==0)
		{
			cout<<-1<<endl;
			continue;
		}
		t1=pow(10,n);
		for(int i=t1/10;i<t1;++i)
		{
			if(check_ou(i)&&cheack_yin(i))
			{
				res.push_back(i);
			}
		}
		if(res.size())
		{
			cout<<res.size()<<endl;
			for(int i=0;i<res.size();++i)
			{
				cout<<res[i]<<endl;
			}
		}
		else
		{
			cout<<-1<<endl;
		}
	}
}

Details

小提示:点击横条可展开更详细的信息

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 1308kb

input:

20 10
-715624307 -28629151
957936621 17210368
-753657459 59049
-40974960 5153632
-402454312 -3450252...

output:

-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1

result:

wrong answer expected 11.3999000000, found -1.0000000000

Subtask #2:

score: 0
Wrong Answer

Test #6:

score: 0
Wrong Answer
time: 0ms
memory: 1312kb

input:

200 10
-487405787 3200000
725249085 28629151
-671026855 -4084101
38046635 45435424
-188495128 643634...

output:

-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-...

result:

wrong answer expected 0.0039000000, found -1.0000000000

Subtask #3:

score: 0
Skipped

Subtask #4:

score: 0
Wrong Answer

Test #18:

score: 0
Wrong Answer
time: 6ms
memory: 1308kb

input:

2000 10
882856800 -387420489
866607093 -134217728
481381898 1
-488180557 1953125
-783185249 -19683
-...

output:

-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-...

result:

wrong answer expected 0.0001000000, found -1.0000000000

Subtask #5:

score: 0
Skipped

Subtask #6:

score: 0
Skipped