Advertisement
Guest User

Untitled

a guest
Jan 25th, 2015
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.49 KB | None | 0 0
  1. #include "Safe.h"
  2. #include <cmath>
  3.  
  4. using namespace std;
  5.  
  6. TPassword res, t_all;
  7. long all = 0;
  8.  
  9. int main()
  10. {
  11.     long n,k;
  12.     Init(n, k);
  13.     for (int i = 0; i < n; i++)
  14.         t_all[i] = 1;
  15.     all = Try(t_all);
  16.     res[n-1] = all;
  17.     for (int i = 0; i < n-1; i++)
  18.     {
  19.         t_all[i] = 2;
  20.         res[i] = (all - Try(t_all) + 3) / 2;
  21.         res[n-1] -= (res[i]-1)*(res[i]-1);
  22.         t_all[i] = 1;
  23.     }
  24.     res[n-1] = sqrt(res[n-1])+1;
  25.     Finish(res);
  26.     return 0;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement