AdvancedLineSeparator
Submit solution
Points:
10
Time limit:
5.0s
Memory limit:
256M
Author:
Problem type
Allowed languages
C#, Go, Java, Python
Completa la classe AdvancedLineSeparator
:
- Afegeix els camps que hi manquen
Completa el mètode Solution.main()
:
- Crida adequadament al mètode
AdvancedLineSeparator.print()
.
import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
class AdvancedLineSeparator {
void print(){
for (int i = 0; i < size; i++) {
System.out.print(charSeparator);
}
System.out.println();
}
}
public class Solution {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
AdvancedLineSeparator lineSeparator = new AdvancedLineSeparator();
String line;
while(!(line = scanner.nextLine()).equals("__END__")) {
lineSeparator.charSeparator = line.charAt(0);
lineSeparator.size = scanner.nextInt();
scanner.nextLine();
System.out.format("Aqui sota apareix una linea de %s %s%n", lineSeparator.size,lineSeparator.charSeparator);
}
}
}
Input Format
-
Constraints
-
Output Format
-
Sample Input 0
*
30
-
35
__END__
Sample Output 0
Aqui sota apareix una linea de 30 *
******************************
Aqui sota apareix una linea de 35 -
-----------------------------------
Sample Input 1
^
30
#
40
=
50
__END__
Sample Output 1
Aqui sota apareix una linea de 30 ^
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Aqui sota apareix una linea de 40 #
########################################
Aqui sota apareix una linea de 50 =
==================================================
Autoria: Gerard Falcó
CC BY-NC-SA 4.0