There was once young lass called Mary,
Whose jokes were occasionally scary.
On this April's Fool
Fixed limerick rules
Allowed her to trip the unwary.
Can she fill all the lines
To work at all times?
On juggling the words
Right around two-thirds
She nearly ran out of rhymes.
Input
The input contains a single integer $a$ ($4 \le a \le 998$). Not every integer in the range is a valid input for the problem; you are guaranteed that the input will be a valid integer.Output
Output a single number.
Examples input
35
output
57
input
57
output
319
input
391
output
1723
Solution:
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); int n; cin >> n; for (int i = 2; i <= n; i++) { while (n % i == 0) { cout << i; n /= i; } } return 0; }
Related posts:
Haar Features
Hidden Bipartite Graph
Minimum spanning tree - Kruskal with Disjoint Set Union
Rectangles and Square
Breaking Good
New Year and Hurry
Long Path
Hongcow Buys a Deck of Cards
Decreasing Debts
Restructuring Company
Guess Your Way Out!
Ehab the Xorcist
Long number
Suffix Tree. Ukkonen's Algorithm
Foo Fighters
Dijkstra Algorithm
Kuroni the Private Tutor
New Year Transportation
Strange Device
Read Time
Big Problems for Organizers
Zip-line
Lazy Security Guard
Parity
Road to 1600
Adding Digits
Maximum flow - Push-relabel method improved
Chicken or Fish?
Into Blocks (easy version)
Check whether a graph is bipartite
Deleting from a data structure in $O(T(n)\log n)$
Xor-Set