Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.*;
- import java.util.*;
- public class Main
- {
- public static void main(String[] args) throws IOException
- {
- new Main().run();
- }
- StreamTokenizer in;
- PrintWriter out;
- int nextInt() throws IOException
- {
- in.nextToken();
- return (int)in.nval;
- }
- void run() throws IOException
- {
- in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
- out = new PrintWriter(new OutputStreamWriter(System.out));
- solve();
- out.flush();
- }
- void solve() throws IOException
- {
- int mod = 33554431;
- int t = nextInt();
- for (int i = 0; i < t; ++i)
- {
- int n = nextInt() + 1;
- int res = 1;
- int a = 2;
- while (n > 0)
- {
- if (n % 2 == 1) res = (int)((res * (long)a) % mod);
- a = (int)((a * (long)a) % mod);
- n >>= 1;
- }
- res = (res + mod - 1) % mod;
- out.println(res);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment