Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace ConsoleApp1
- {
- class Program
- {
- static void Main(string[] args)
- {
- const int n = 7;
- int[] A = new int[n*n] {
- 1, 3, 3, 7, 4, 8, 8,
- 1, 3, 3, 7, 4, 8, 8,
- 1, 3, 3, 7, 4, 8, 8,
- 1, 3, 3, 7, 4, 8, 8,
- 1, 3, 3, 7, 4, 8, 8,
- 1, 3, 3, 7, 4, 8, 8,
- 1, 3, 3, 7, 4, 8, 8
- };
- int[] vec = new int[2 * n - 1];
- for(int j = 0; j < n; j++)
- {
- vec[(2*n - 1)/2] += A[n*j + j];
- for(int f = 1; f < n; f++)
- {
- if(j-f >= 0)
- vec[(2*n - 1)/2 - f] += A[n*(j - f) + j];
- if(j + f < n)
- vec[(2 * n - 1)/2 + f] += A[n*(j + f) + j];
- }
- }
- for(int i = 0; i < 2*n - 1; i++)
- Console.Write("{0:d} ", vec[i]);
- Console.ReadKey();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement