Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /******************************************************************************
- Online C++ Compiler.
- Code, Compile, Run and Debug C++ program online.
- Write your code in this editor and press "Run" button to compile and execute it.
- *******************************************************************************/
- #include <iostream>
- #include <algorithm>
- using namespace std;
- int res[1000][100];
- int ish[130];
- int main()
- {
- cout << "Размер вектора(альфа = ..x^0 + ..x^1 + ...):\n";
- int n;
- cin >> n;
- cout << "вектор альфа = ..x^0 + ..x^1 + ... :\n";
- for(int i = 0; i < n; i++)
- cin >> ish[i];
- cout << "харка x поля Z_x(модуль):\n";
- int mod;
- cin >> mod;
- for(int i = 0; i < n; i++) {
- res[i][i] = 1;
- }
- for(int i = 0; i < 130; i++)
- res[n][i] = ish[i];
- for(int i = n+1; i < 130; i++) {
- for(int j = 1; j < 130; j++) {
- res[i][j] = res[i-1][j-1];
- }
- int mult = res[i][n];
- res[i][n] = 0;
- for(int j = 0; j < n; j++) {
- res[i][j] = (res[i][j] + mult*res[n][j])%mod;
- }
- }
- for(int i = 0; i < 130; i++) {
- cout << "#" << i << ": ";
- for(int j = 0; j < n+2; j++) {
- cout << res[i][j] << ' ';
- }
- cout << '\n';
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement