pat-Serie B-1006 output integers in a different format

Source: Internet
Author: User

Let's use B the letter to denote "hundred", the letter S means "Ten", 12...n to represent a non-zero digit n (<), in a different format to output any of the 3-bit positive integers. For example 234 , it should be output BBSSS1234 because it has 2 "hundred", 3 "ten", and a single digit of 4.

Input Format:

Each test input contains 1 test cases, giving a positive integer N (<).

output Format:

The output of each test case is one line, and n is output in the specified format .

Input Sample 1:
234
Output Example 1:
BBSSS1234
Input Sample 2:
23
Output Example 2:
SS123


Analysis:
Three digits according to the hundred, 10 bits, you store
Convert to the corresponding rule output


1 /*C*/2#include <stdio.h>3 intMain ()4 {5   intn,i,m;6scanf"%d",&n);7m = n/ -;8N%= -;9    for(i=0; i<m;i++)TenPutchar ('B'); Onem = n/Ten; AN%=Ten; -    for(i=0; i<m;i++) -Putchar ('S'); the    for(i=1; i<=n;i++) -Putchar (i+ -); -     return 0;  - } +   

pat-Serie B-1006 output integers in a different format

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.