Advertisement
Guest User

Untitled

a guest
May 20th, 2019
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. #include <fstream>
  2.  
  3. using namespace std;
  4.  
  5. ifstream fin("5.in");
  6. ofstream fout("5.out");
  7.  
  8. int main()
  9. {
  10. int n, M[100][100];
  11.  
  12. fin >> n;
  13.  
  14. for (int i = 0; i < n; i ++)
  15. for (int j = 0; j < n; j ++)
  16. fin >> M[i][j];
  17.  
  18. for (int i = 0; i < n; i ++)
  19. for (int j = 0; j < n; j ++)
  20. if (i + j == n + 1)
  21. {
  22. int F = 0, N[2] = {1, 1};
  23.  
  24. while (F <= M[i][j])
  25. {
  26. F = N[0] + N[1];
  27. N[1] = N[0];
  28. N[0] = F;
  29. }
  30.  
  31. if (F == M[i][j])
  32. fout << M[i][j];
  33. }
  34.  
  35. return 0;
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement