-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathI006.java
42 lines (40 loc) · 1.12 KB
/
I006.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package levelB;
import java.util.ArrayList;
import java.util.Scanner;
public class I006 {
public static void main(String[] args) {
Scanner s=new Scanner(System.in);
int N=s.nextInt();
ArrayList<String> list=new ArrayList<>();
int count=0;
while(N!=0){
String str="";
int num=N%10;
count++;
switch (count){
case 1:
for(int i=1;i<=num;i++){
str+=i;
}
list.add(str);
break;
case 2:
for(int i=0;i<num;i++){
str+='S';
}
list.add(str);
break;
case 3:
for(int i=0;i<num;i++){
str+='B';
}
list.add(str);
break;
}
N=N/10;
}
for(int i=list.size()-1;i>=0;i--){
System.out.print(list.get(i));
}
}
}