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:
Bacterial Melee
Optimal Subsequences (Easy Version)
Dice Tower
Number of Ways
A + B Strikes Back
Lost Array
Dating
K-th order statistic in O(N)
Challenges in school №41
Princesses and Princes
Half-plane intersection - S&I Algorithm in O(Nlog N)
Again?
Intersection Point of Lines
Deduction Queries
Linear Diophantine Equation
Balls and Boxes
Paint the Numbers
Fair
Cheap Travel
Berland Miners
Lyndon factorization
Save the problem
Guess Your Way Out!
Travel Card
Sliding Doors
Little Artem and Random Variable
Generate a String
Middle Class
Diverse Permutation
Sum of Nestings
Magic Grid
Hilbert's Hotel