UOJ Logo

NOI.AC

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#208007#3758. 拆分yhmm1000ms1200kbC++11427b2024-08-01 11:32:182024-08-01 12:13:05

answer

#include<bits/stdc++.h>
#pragma GCC optimize(2)
using namespace std;
int n;
bool check(int x)
{
	for(int i=2;i*i<=x;i++)
	{
		if(x%i==0)
		{
			return false;
		}
	}
	return true;
}
int main(){
	cin>>n;
	if(n<=1e8)
	{
		if(check(n-1))
		{
			cout<<1<<' '<<n-1;
			return 0;
		}
	}
	for(int i=2;i<=n/2;i++)
	{
		if(check(i)&&check(n-i))
		{
			cout<<i<<' '<<n-i;
			return 0;
		}
	}
	return 0;
}

Details

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

Test #1:

score: 10
Accepted
time: 0ms
memory: 1200kb

input:

92

output:

3 89

result:

ok ok, f(a)+f(b)=4

Test #2:

score: 10
Accepted
time: 0ms
memory: 1196kb

input:

88

output:

5 83

result:

ok ok, f(a)+f(b)=4

Test #3:

score: 10
Accepted
time: 0ms
memory: 1196kb

input:

74

output:

1 73

result:

ok ok, f(a)+f(b)=3

Test #4:

score: 10
Accepted
time: 0ms
memory: 1200kb

input:

99496

output:

149 99347

result:

ok ok, f(a)+f(b)=4

Test #5:

score: 10
Accepted
time: 0ms
memory: 1200kb

input:

97768

output:

191 97577

result:

ok ok, f(a)+f(b)=4

Test #6:

score: 10
Accepted
time: 0ms
memory: 1196kb

input:

70744

output:

137 70607

result:

ok ok, f(a)+f(b)=4

Test #7:

score: 10
Accepted
time: 0ms
memory: 1200kb

input:

101260118

output:

1039 101259079

result:

ok ok, f(a)+f(b)=4

Test #8:

score: 10
Accepted
time: 0ms
memory: 1196kb

input:

900200416

output:

977 900199439

result:

ok ok, f(a)+f(b)=4

Test #9:

score: 10
Accepted
time: 0ms
memory: 1196kb

input:

980144336

output:

883 980143453

result:

ok ok, f(a)+f(b)=4

Test #10:

score: 10
Accepted
time: 0ms
memory: 1200kb

input:

990429172

output:

1061 990428111

result:

ok ok, f(a)+f(b)=4

Extra Test:

score: 0
Extra Test Passed