September 2021

B - Its Easier Than You Think

Solution

\[\]

Implementation in C++

#include <iostream>

using namespace std;

int main() {
    int t, n;
    scanf("%d", &t);
    
    while (t--) {
        cin>>n;
        
        //The number of pairs is n+1
        cout<<n+1<<"\n";
    }
    
    return 0;
}
\[\]

Implementation in Java

import java.io.*;
import java.util.*;

public class Solution {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        
        int t, n;
        t = scan.nextInt();
        
        while (t-- > 0) {
            n = scan.nextInt();
            
            //The number of pairs is n+1
            System.out.println(n+1);
        }
    }
}
\[\]

Implementation in Python

t = int(input())
for _ in range(t):
    n = int(input())
    
    # The number of pairs is n+1
    print(n+1)
\[\]

Contest Material