UOJ Logo

NOI.AC

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#207943#3758. 拆分Chenzihan08261001057ms1196kbC++11423b2024-08-01 10:20:052024-08-01 12:08:53

answer

#include<bits/stdc++.h>
#define	int	long long
using namespace std;

int check(int x)
{
	int ans=0;
	for(int i=1;i*i<=x;i++)
	{
		if(i*i==x)ans--;
		if(x%i==0)ans+=2;
	}
	return ans;
}

signed main()
{
	int x,minn=100000009;cin>>x;
	for(int i=1;i<=x;i++)
	{
		int p=check(i)+check(x-i);
		if(p<=4)
		{
			cout<<i<<" "<<x-i;
			return 0;	
		}
		minn=min(minn,p);
	}
	cout<<minn;
	return 0;
}


详细

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

Test #1:

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

input:

92

output:

3 89

result:

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

Test #2:

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

input:

88

output:

5 83

result:

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

Test #3:

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

input:

74

output:

1 73

result:

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

Test #4:

score: 10
Accepted
time: 1ms
memory: 1192kb

input:

99496

output:

149 99347

result:

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

Test #5:

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

input:

97768

output:

191 97577

result:

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

Test #6:

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

input:

70744

output:

137 70607

result:

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

Test #7:

score: 10
Accepted
time: 114ms
memory: 1192kb

input:

101260118

output:

1039 101259079

result:

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

Test #8:

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

input:

900200416

output:

977 900199439

result:

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

Test #9:

score: 10
Accepted
time: 286ms
memory: 1192kb

input:

980144336

output:

883 980143453

result:

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

Test #10:

score: 10
Accepted
time: 349ms
memory: 1192kb

input:

990429172

output:

1061 990428111

result:

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

Extra Test:

score: 0
Extra Test Passed