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
Get the Hundred, 10-digit and single-digit numbers, then output.
#include <bits/stdc++.h>using namespacestd;intMain () {intN; intdigithundred, Digitten, DigiTone; while(SCANF ("%d", &n)! =EOF) {digithundred= N/ -; Digitten= (n/Ten) %Ten; DigiTone= n%Ten; for(inti =0; i < digithundred; ++i) {printf ("B"); } for(inti =0; i < Digitten; ++i) {printf ("S"); } for(inti =0; i < DigiTone; ++i) {printf ("%d", i+1); } printf ("\ n"); } return 0;}
Capouis ' CODE
pat-basic-1006-output integers in a different format