Cod sursa(job #2022434)
| Utilizator | Data | 16 septembrie 2017 15:52:29 | |
|---|---|---|---|
| Problema | 12-Perm | Scor | 80 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.54 kb |
#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 = 1; j <= 4; ++j) {
x[j] = x[j + 1];
y[j] = y[j + 1];
}
x[5] &= msk, y[5] &= msk;
}
int ans = x[5] + y[5];
ans &= msk;
cout << ans;
}
