Resolution of Pat computer questions in Zhejiang University 1006. Output integer in another format (15)

Source: Internet
Author: User
1006. Output in another format INTEGER (15) Time Limit 400 MS
The memory limit is 32000 kb.
Code length limit: 8000 B
Criterion author Chen, Yue

Let's use the letter B to represent "Hundred", the letter S to represent "Ten", and "12... N (<10) is a single digit. In another format, a positive integer of no more than three digits is output. For example, 234 should be output as bbsss1234 because it has two "hundreds", three "Ten", and four digits.

Input Format:Each test input contains one test case and a positive integer N (<1000 ).

Output Format:The output of each test case occupies one line and outputs N in the specified format.

Input Example 1:

234

Output Example 1:

Bbsss1234

Input Example 2:

23

Output Example 2:

Ss123
 
# Include <iostream> using namespace STD; int main () {int N, I; int B = 0; int S = 0; int G = 0; CIN> N; G = n % 10; N/= 10; S = n % 10; N/= 10; B = n % 10; for (I = 0; I <B; I ++) cout <"B"; for (I = 0; I <s; I ++) cout <"S"; for (I = 1; I <= g; I ++) cout <I; cout <Endl; return 0 ;}

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.