Guest User

Untitled

a guest
Jun 9th, 2015
394
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.09 KB | None | 0 0
  1. import java.io.*;
  2. import java.util.*;
  3.  
  4. public class Main
  5. {
  6.     public static void main(String[] args) throws IOException
  7.     {
  8.         new Main().run();
  9.     }
  10.    
  11.     StreamTokenizer in;
  12.     PrintWriter out;
  13.    
  14.     int nextInt() throws IOException
  15.     {
  16.         in.nextToken();
  17.         return (int)in.nval;
  18.     }
  19.    
  20.     void run() throws IOException
  21.     {
  22.         in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
  23.         out = new PrintWriter(new OutputStreamWriter(System.out));
  24.         solve();
  25.         out.flush();
  26.     }
  27.    
  28.     void solve() throws IOException
  29.     {
  30.         int mod = 33554431;
  31.         int t = nextInt();
  32.         for (int i = 0; i < t; ++i)
  33.         {
  34.             int n = nextInt() + 1;
  35.             int res = 1;
  36.             int a = 2;
  37.             while (n > 0)
  38.             {
  39.                 if (n % 2 == 1) res = (int)((res * (long)a) % mod);
  40.                 a = (int)((a * (long)a) % mod);
  41.                 n >>= 1;
  42.             }
  43.             res = (res + mod - 1) % mod;
  44.             out.println(res);
  45.         }    
  46.     }
  47. }
Advertisement
Add Comment
Please, Sign In to add comment