Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Collections.Specialized;
- using System.Globalization;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace myloyorrr
- {
- internal class Program
- {
- static void In(out int[][] a)
- {
- int n = int.Parse(Console.ReadLine());
- a = new int[n][];
- for (int i = 0; i < a.GetLength(0); i++)
- {
- int m = int.Parse(Console.ReadLine());
- string[] s = Console.ReadLine().Split();
- a[i] = new int[m];
- for (int j = 0; j < m; j++)
- {
- a[i][j] = int.Parse(s[j]);
- }
- }
- }
- static void Out(int[] a)
- {
- for (int i = 0; i < a.GetLength(0); i++)
- {
- Console.Write(a[i] + " ");
- }
- }
- static void Main()
- {
- int[][] a;
- In(out a);
- int k1 = int.Parse(Console.ReadLine());
- int k2 = int.Parse(Console.ReadLine());
- int r = a.GetLength(0);
- int[] ans;
- ans = new int[r];
- for (int i = 0; i < a.GetLength(0); i++)
- {
- int comp = 1;
- //Console.WriteLine(a[i].Length);
- if (k1 > a[i].Length-1)
- {
- comp = 0;
- }
- else if (a[i].Length <= k2 && a[i].Length > k1)
- {
- for (int j = k1; j < a[i].Length; j++)
- {
- comp *= a[i][j];
- }
- }
- else if (a[i].Length > k2 && a[i].Length > k1)
- {
- for (int j = k1; j <= k2; j++)
- {
- comp *= a[i][j];
- }
- }
- ans[i] = comp;
- }
- Out(ans);
- }
- }
- }
- // когда к1 больше чем кол-во эл-ов в массиве
- 4
- 2
- 1 2
- 5
- 5 7 8 9 4
- 6
- 1 4 5 2 7 8
- 2
- 5 8
- 2
- 4
- // когда к1 норм
- 5
- 4
- 1 2 3 4
- 3
- 1 2 4
- 5
- 2 5 7 8 9
- 3
- 1 2 4
- 4
- 5 6 7 8
- 0
- 2
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement