Pagini recente » Cod sursa (job #93417) | Cod sursa (job #713583) | Cod sursa (job #264619) | Cod sursa (job #304745) | Cod sursa (job #2022433)
#include <bits/stdc++.h>
using namespace std;
const int msk = (1 << 20) - 1;
int n, x[7], y[7], ax[7], ay[7];
int main() {
ifstream cin("12perm.in");
ofstream cout("12perm.out");
cin >> n;
x[0] = 1;
x[1] = 1;
x[2] = 2;
y[3] = 2;
x[3] = 4;
y[4] = 4;
x[4] = 8;
int r = 4;
for(int i = 5; i <= n; ++i) {
x[5] = x[4] + x[2] + 2;
y[5] = y[4] + x[3];
for(int j = 4; j >= 1; --j) {
ax[j] = x[j + 1];
ay[j] = y[j + 1];
}
for(int j = 4; j >= 1; --j)x[j] = ax[j], y[j] = ay[j];
x[5] &= msk, y[5] &= msk;
}
int ans = x[5] + y[5];
ans &= msk;
cout << ans;
}