GastonFontenla

Timus: 1352 - Mersenne Primes

Jun 5th, 2016
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.50 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     int a[39] = {
  8.         2, 3, 5, 7, 13, 17, 19, 31, 61, 89, 107, 127,
  9.         521, 607, 1279, 2203, 2281, 3217, 4253, 4423,
  10.         9689, 9941, 11213, 19937, 21701, 23209, 44497,
  11.         86243, 110503, 132049, 216091, 756839, 859433,
  12.         1257787, 1398269, 2976221, 3021377, 6972593
  13.     };
  14.  
  15.     int n, k;
  16.     cin >> n;
  17.     for(int i=0; i<n; i++)
  18.     {
  19.         cin >> k;
  20.         cout << a[k-1] << endl;
  21.     }
  22.  
  23.     return 0;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment