fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. int N, i;
  13. Scanner ler = new Scanner(System.in);
  14.  
  15. N = ler.nextInt();
  16.  
  17. for(i = 0; i < N; i++){
  18. System.out.print("V" + (i < N - 1 ? " " : "!"));
  19. }
  20. System.out.println(); //separar os dois testes
  21.  
  22. for(i = 0; i < N - 1; i++){
  23. System.out.print("V ");
  24. }
  25. if (N > 0) {
  26. System.out.println("V!");
  27. }
  28. }
  29. }
Success #stdin #stdout 0.08s 29468KB
stdin
5
stdout
V V V V V!
V V V V V!