₦airaland Forum

Welcome, Guest: RegisterLoginWith GoogleTrendingRecentNew

Stats: 3,329,553 members, 8,441,180 topics. Date: Wednesday, 08 July 2026 at 07:43 AM

Toggle theme

Another Programming Problem For Those That Love DSA problems - Programming - Nairaland

Nairaland ForumScience/TechnologyProgrammingAnother Programming Problem For Those That Love DSA problems (643 Views)

1 Reply (Go Down)

Another Programming Problem For Those That Love DSA problems by turmacs(op):
Check this problem......

Problem statement
A sentien is a integer who's digits are all 1 in decimal representation. The sentiens in ascending are 1,11,111,........ and so on.
Your task is to find the N'th smallest integer that can be represented as the sum of exactly three sentiens.

Constraints
N is an integer between 1 and 333, inclusive

Input
The only line of the input contains N.

Output
Output the N'th smallest integer that can be represented as the sum of three sentiens.

Example
Input 1
5
Output 1
113

The integers that can be represented as the sum of exactly three sentiens are 3,13,23,33,113,.... in ascending order. For example, you can express 113 as 113 = 1 + 1 + 111, you can express 3 as 3 = 1+1+1, you can express 13 as 13 = 1 + 1 + 11.
Note that the three sentiens do not have to be different.

Input 2
19
Output 2
2333

Input 3
333
Output 3
112222222233
Re: Another Programming Problem For Those That Love DSA problems by turmacs(op): 8:56am On Jun 14, 2024
smiley
Re: Another Programming Problem For Those That Love DSA problems by psucc(m): 8:59am On Jun 14, 2024
Hope this doesn't include Nigerians? Because no hungry man can ever solve mathematical problem correctly o
Re: Another Programming Problem For Those That Love DSA problems by Shomek(m): 1:21pm On Jun 14, 2024
I can't just understand you What do take us for ? Do you want us to be helping you to solve your problems for free or what ?
Re: Another Programming Problem For Those That Love DSA problems by turmacs(op): 1:32pm On Jun 14, 2024
Shomek:
I can't just understand you
What do take us for ?
Do you want us to be helping you to solve your problems for free or what ?
Who's "us" ? Because last time I checked, I never mentioned your fathers name anywhere on the thread... I just posted the problem for anyone that would love to challenge themselves or likes leetcode style problems. If you can't or don't want to solve it then you move, abi what's your problem? undecided
Re: Another Programming Problem For Those That Love DSA problems by Shomek(m): 1:40pm On Jun 14, 2024
turmacs:
Who's "us" ? Because last time I checked, I never mentioned your fathers name anywhere on the thread... I just posted the problem for anyone that would love to challenge themselves or likes leetcode style problems. If you can't or don't want to solve it then you move, abi what's your problem? undecided
You are just foolish naturally
You this ugly girl calling my father's name

never in your life don't try that again or else
{ you will see shege here on nl }
Re: Another Programming Problem For Those That Love DSA problems by turmacs(op): 1:53pm On Jun 14, 2024
Shomek:
You are just foolish naturally
You this ugly girl calling my father's name

never in your life don't try that again or else
{ you will see shege here on nl }
It is your mother that is an ugly girl
Re: Another Programming Problem For Those That Love DSA problems by BlackhatMentor: 1:56pm On Jun 14, 2024
turmacs:
Check this problem......

Problem statement
A sentien is a integer who's digits are all 1 in decimal representation. The sentiens in ascending are 1,11,111,........ and so on.
Your task is to find the N'th smallest integer that can be represented as the sum of exactly three sentiens.

Constraints
N is an integer between 1 and 333, inclusive

Input
The only line of the input contains N.

Output
Output the N'th smallest integer that can be represented as the sum of three sentiens.

Example
Input 1
5
Output 1
113

The integers that can be represented as the sum of exactly three sentiens are 3,13,23,33,113,.... in ascending order. For example, you can express 113 as 113 = 1 + 1 + 111, you can express 3 as 3 = 1+1+1, you can express 13 as 13 = 1 + 1 + 11.
Note that the three sentiens do not have to be different.

Input 2
19
Output 2
2333

Input 3
333
Output 3
112222222233
Can you go-to the kitchen and do the dishes and leave programming alone?
Re: Another Programming Problem For Those That Love DSA problems by Shomek(m): 1:34am On Jun 15, 2024
turmacs:
It is your mother that is an ugly girl
Foolish girl

go and tell your parent that they are both stupid
Re: Another Programming Problem For Those That Love DSA problems by Shomek(m): 1:38am On Jun 15, 2024
BlackhatMentor:
Can you go-to the kitchen and do the dishes and leave programming alone?
don't mind her
Do you even think she can cook ?

She can't even boil ordinary water
Re: Another Programming Problem For Those That Love DSA problems by Domaining101:
I swear a lot of you here have problems.
1 Reply

Is DSA Really Necessary For A Programmer/web, App Developer?Need A DSA And Job Application PartnerProblems Young Developers Face In Nigeria234

Windows 10 Upgrade: You'll Have To Wait...What Can We Do For You With The Fastest Converting Animations?Admission In Western European Ukraine National University.