-
Notifications
You must be signed in to change notification settings - Fork 120
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6d24064
commit 150ed36
Showing
2 changed files
with
130 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
Tony has been assigned a number n and was asked to represent it as a sum of maximum possible number of prime numbers.One can prove that such representation exists for any integer greater than 1. Help Tony to solve this problem. | ||
|
||
Input variables:- | ||
int t=> no. of test cases | ||
int n=> assigned number | ||
|
||
Input Description:- | ||
-First line of input consists of t, the number of test cases | ||
-Next each lines consist of n, the assigned number | ||
|
||
Output Description:- | ||
-The first line of the output contains a single integer k — maximum possible number of primes in representation. | ||
-The second line should contain k primes with their sum equal to n. You can print them in any order. If there are several optimal solution, print any of them. | ||
|
||
Constraints:- | ||
-> 1<=t<=100 | ||
-> 1<=n<=1000 | ||
|
||
Sample Input:- | ||
2 | ||
5 | ||
6 | ||
|
||
Sample Output:- | ||
2 | ||
2 3 | ||
3 | ||
2 2 2 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
100 | ||
367 | ||
358 | ||
569 | ||
637 | ||
696 | ||
165 | ||
785 | ||
924 | ||
433 | ||
292 | ||
479 | ||
590 | ||
61 | ||
964 | ||
825 | ||
417 | ||
263 | ||
68 | ||
728 | ||
907 | ||
611 | ||
362 | ||
590 | ||
780 | ||
443 | ||
30 | ||
818 | ||
904 | ||
44 | ||
808 | ||
431 | ||
108 | ||
683 | ||
636 | ||
81 | ||
762 | ||
574 | ||
74 | ||
897 | ||
163 | ||
657 | ||
859 | ||
889 | ||
339 | ||
629 | ||
342 | ||
792 | ||
897 | ||
935 | ||
881 | ||
646 | ||
480 | ||
577 | ||
458 | ||
111 | ||
24 | ||
673 | ||
474 | ||
471 | ||
455 | ||
460 | ||
234 | ||
613 | ||
153 | ||
858 | ||
531 | ||
97 | ||
970 | ||
727 | ||
497 | ||
658 | ||
286 | ||
454 | ||
842 | ||
500 | ||
8 | ||
784 | ||
612 | ||
436 | ||
217 | ||
326 | ||
577 | ||
148 | ||
263 | ||
475 | ||
85 | ||
66 | ||
857 | ||
693 | ||
372 | ||
49 | ||
944 | ||
295 | ||
460 | ||
949 | ||
893 | ||
212 | ||
175 | ||
483 | ||
539 |