?
# | Author | Problem | Lang | Verdict | Time | Memory | Sent | Judged | |
---|---|---|---|---|---|---|---|---|---|
104614811 |
Practice: pranav232323 |
1430C - 6 | Java 8 | Time limit exceeded on test 2 | 2000 ms | 0 KB | 2021-01-17 22:33:24 | 2021-01-17 22:33:24 |
//package com.codeforces.EducationalRound96; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class Div2C { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader(new InputStreamReader(System.in)); } String next() { while (st == null || !st.hasMoreElements()) { try { st = new StringTokenizer(br.readLine()); } catch (IOException e) { e.printStackTrace(); } } return st.nextToken(); } int nextInt() { return Integer.parseInt(next()); } long nextLong() { return Long.parseLong(next()); } double nextDouble() { return Double.parseDouble(next()); } String nextLine() { String str = ""; try { str = br.readLine(); } catch (IOException e) { e.printStackTrace(); } return str; } } public static void main(String[] args) { FastReader s = new FastReader(); long n; long curr; int T = s.nextInt(); for (int i = 0; i < T; i++) { n = s.nextInt(); System.out.println(2); System.out.printf("%d %d\n", n, n - 1); curr = n; for (long j = n - 2; j >= 1; j--) { System.out.printf("%d %d\n", curr, j); curr = ((curr + j) % 2) == 0 ? ((curr + j) / 2) : ((curr + j) / 2) + 1; } } } }
?
?
?
?