Let us use the letter B to denote "hundred", the letter S for "Ten", "12...N" to represent the single digit n (<10), in a different format to output any of the 3-bit positive integer. For example, 234 should be output as 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 (<1000).
Output format: one row for each test case output n in the specified format.
Input Sample 1:
234
Output Example 1:
BBSSS1234
Input Sample 2:
23
Output Example 2:
SS123
1#include <iostream>2 using namespacestd;3 intMain ()4 {5 intn,i;6Cin>>N;7 if(n>=1&&n<=9)8 for(i=1; i<=n;i++)9cout<<i;Ten Else if(n<= About) One { A for(i=1; i<=n/Ten; i++) -cout<<"S"; - for(i=1; i<=n%Ten; i++) thecout<<i; - } - Else - { + for(i=1; i<=n/ -; i++) -cout<<"B"; + for(i=1; i<=n/Ten%Ten; i++) Acout<<"S"; at for(i=1; i<=n%Ten; i++) -cout<<i; - } - //System ("pause"); - return 0; -}View Code
Pat 1006. Output integers in a different format (15)