Advertisement
Guest User

Untitled

a guest
Sep 19th, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. public class Solution {
  2. public static void main(String[] args) throws IOException {
  3. //BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
  4. Scanner scan = new Scanner(System.in);
  5. ArrayList<String> listString = new ArrayList<String>();
  6. //int n = Integer.parseInt(reader.readLine());
  7. //int m = Integer.parseInt(reader.readLine());
  8. int n = scan.nextInt();
  9. int m = scan.nextInt();
  10. int a = 0;
  11. for (int x = 0; x < n; x++) {
  12. if (x < m) {
  13. //listString.add(reader.readLine());
  14. listString.add(scan.nextLine());
  15. }
  16. else if (x >= m) {
  17. //listString.add(0 + a,reader.readLine());
  18. listString.add(0 + a,scan.nextLine());
  19. a++;
  20. }
  21. }
  22. for (String x : listString) System.out.println(x);
  23. }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement