题解 | #字符金字塔#
字符金字塔
http://www.nowcoder.com/practice/0fae60c3b5c64699b7c0f031c2187dde
public class Main {
public static void main(String[] args) throws IOException{
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String s = in.readLine();
for (int i =1; i < 6; i++) {
switch (i){
case 1:
System.out.printf(" %s\n",s);
continue;
case 2:
System.out.printf(" %s %s\n",s,s);
continue;
case 3:
System.out.printf(" %s %s %s\n",s,s,s);
continue;
case 4:
System.out.printf(" %s %s %s %s\n",s,s,s,s);
continue;
case 5:
System.out.printf("%s %s %s %s %s\n",s,s,s,s,s);
continue;
}
}
}
}