Submission #202830

# Submission time Handle Problem Language Result Execution time Memory
202830 2020-02-18T06:08:29 Z coloredrabbit Phibonacci (kriii2_P) C++17
Compilation error
0 ms 0 KB
#include<iostream>
#include<cstring>
#include<cassert>
using namespace std;
using ll = __int128;
const int LIMIT = 126, M = 1e9 + 7;
const ll MOD = (long long)M * M;
struct _mt {
	ll m[2][2];
	_mt() { memset(m, 0, sizeof m); }
	void E() { for (int i = 0; i < 2; i++) m[i][i] = 1; }
	_mt operator*(const _mt& o) {
		_mt r;
		int i, j, k;
		for (i = 0; i < 2; i++)for (j = 0; j < 2; j++) for (k = 0; k < 2; k++)
			r.m[i][j] = (r.m[i][j] + m[i][k] * o.m[k][j]) % M;
		return r;
	}
}F[LIMIT], NK, K;
ll _pow(ll a, ll n) {
	if (n == 1) return a;
	ll h = _pow(a, n >> 1);
	return (h * h % M) * (n % 2 ? a : 1) % M;
}
int main() {
	freopen
	ll n, k, A, B, i, nk, bitset_v = 1;
	long long tN, tK;
	cin >> tN >> tK;
	n = tN, k = tK;
	F[0].m[0][0] = F[0].m[0][1] = F[0].m[1][0] = 1;
	NK.E(); K.E();
	nk = k * n;
	for (i = 1; i < LIMIT; i++) F[i] = F[i - 1] * F[i - 1];
	for (i = 0; i < LIMIT; i++) {
		if ((bitset_v << i) & nk) NK = NK * F[i];
		if ((bitset_v << i) & k) K = K * F[i];
	}
	assert(K.m[0][1] > 0);
	A = (NK.m[0][1] % M) * _pow(K.m[0][1] % M, M - 2) % M;
	B = ((NK.m[1][1] % M) - A * (K.m[1][1] % M) % M + M) % M;
	cout << (long long)A << ' ' << (long long)B;
	return 0;
}

Compilation message

P.cpp: In function 'int main()':
P.cpp:27:2: error: expected ';' before 'll'
  ll n, k, A, B, i, nk, bitset_v = 1;
  ^~
P.cpp:27:36: warning: statement is a reference, not call, to function 'freopen' [-Waddress]
  ll n, k, A, B, i, nk, bitset_v = 1;
                                    ^
P.cpp:27:36: warning: statement has no effect [-Wunused-value]
P.cpp:30:2: error: 'n' was not declared in this scope
  n = tN, k = tK;
  ^
P.cpp:30:10: error: 'k' was not declared in this scope
  n = tN, k = tK;
          ^
P.cpp:33:2: error: 'nk' was not declared in this scope
  nk = k * n;
  ^~
P.cpp:34:7: error: 'i' was not declared in this scope
  for (i = 1; i < LIMIT; i++) F[i] = F[i - 1] * F[i - 1];
       ^
P.cpp:35:7: error: 'i' was not declared in this scope
  for (i = 0; i < LIMIT; i++) {
       ^
P.cpp:36:8: error: 'bitset_v' was not declared in this scope
   if ((bitset_v << i) & nk) NK = NK * F[i];
        ^~~~~~~~
P.cpp:36:8: note: suggested alternative: 'sigset_t'
   if ((bitset_v << i) & nk) NK = NK * F[i];
        ^~~~~~~~
        sigset_t
P.cpp:37:8: error: 'bitset_v' was not declared in this scope
   if ((bitset_v << i) & k) K = K * F[i];
        ^~~~~~~~
P.cpp:37:8: note: suggested alternative: 'sigset_t'
   if ((bitset_v << i) & k) K = K * F[i];
        ^~~~~~~~
        sigset_t
P.cpp:40:2: error: 'A' was not declared in this scope
  A = (NK.m[0][1] % M) * _pow(K.m[0][1] % M, M - 2) % M;
  ^
P.cpp:41:2: error: 'B' was not declared in this scope
  B = ((NK.m[1][1] % M) - A * (K.m[1][1] % M) % M + M) % M;
  ^