Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "bits/stdc++.h"
- using namespace std;
- #define fast ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
- const int mod = 1e9 + 7;
- #define int long long
- typedef vector < vector < int > > matrix;
- inline int add(int x, int y) {
- return (x + y) % mod;
- }
- inline int mul(int x, int y) {
- return (x * y) % mod;
- }
- inline matrix mul(matrix v1, matrix v2) {
- vector< vector<int>> ans(2, vector<int> (2));
- for (int i = 0; i < 2; ++i) {
- for (int j = 0; j < 2; ++j) {
- for (int k = 0; k < 2; ++k) {
- ans[i][j] = add(ans[i][j], mul(v1[i][k], v2[j][k]));
- }
- }
- }
- return ans;
- }
- matrix po(matrix cur, int n) {
- matrix res{
- {1, 0},
- {0, 1}
- };
- while (n) {
- if (n & 1) {
- res = mul(res, cur);
- }
- cur = mul(cur, cur);
- n >>= 1;
- }
- return res;
- }
- signed main() {
- int t, a, b, n, cnt(0);
- cin >> t;
- vector < vector < int > > v{
- {1, 1},
- {1, 0}
- };
- while (t--) {
- cnt = 0;
- cin >> a >> b >> n;
- vector< vector<int>> cur(2, vector<int> (2));
- cur[0][0] = 1;
- cur[1][0] = 1;
- cur[1][1] = 0;
- cur[0][1] = 1;
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment