SilverbachConjecture
SRM 617 · 2013-12-22 · by dolphinigle
SRM 617 · 2013-12-22 · by dolphinigle · Simple Math
Problem Statement
Problem Statement
In this problem, some test cases have more than one correct output. We are using a special checker to verify that the output of your program is correct.
A positive integer x is called composite if there are positive integers y > 1 and z > 1 such that x = yz. In other words, a composite positive integer has a positive integer divisor other than 1 and itself. For example, 48 is composite because 48 = 4*12. The smallest few composite integers are 4, 6, 8, 9, and 10.
You are given anint n.
Return a int[] with two elements.
Both elements of the returned int[] must be positive composite integers, and their sum must be n.
For the given constraints on n at least one such pair always exists. Note that if there are many such pairs, your solution can return any one of them.
A positive integer x is called composite if there are positive integers y > 1 and z > 1 such that x = yz. In other words, a composite positive integer has a positive integer divisor other than 1 and itself. For example, 48 is composite because 48 = 4*12. The smallest few composite integers are 4, 6, 8, 9, and 10.
You are given an
For the given constraints on n at least one such pair always exists. Note that if there are many such pairs, your solution can return any one of them.
Constraints
- n will be between 20 and 2000, inclusive.
Examples
0)
20
Returns: {8, 12 }
For n=20 there are seven correct answers: {4,16}, {6,14}, {8,12}, {10,10}, {12,8}, {14,6}, and {16,4}. Your program must return one of these seven answers.
1)
30
Returns: {15, 15 }
You may return two identical numbers.
2)
999
Returns: {699, 300 }
3)
2000
Returns: {4, 1996 }
4)
25
Returns: {9, 16 }
Submissions are judged against all 53 archived test cases, of which 5 are shown here. Case numbers match the judge’s.
Coding Area
Language: C++17 · define a public class SilverbachConjecture with a public method vector<int> solve(int n) · 53 test cases · 2 s / 256 MB per case