Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- namespace mainSolution
- {
- class Input
- {
- private static IEnumerator<string> getin()
- {
- while (true)
- foreach (string s in Console.ReadLine().Split().Where(x => x.Length > 0))
- yield return s;
- }
- private IEnumerator<string> inp = getin();
- public string GetString() { inp.MoveNext(); return inp.Current; }
- public int GetInt() { return int.Parse(GetString()); }
- public long GetLong() { return long.Parse(GetString()); }
- public double GetDouble() { return double.Parse(GetString()); }
- }
- static class Program
- {
- static bool check(int n)
- {
- n = (n > 0 ? n : -n);
- bool[] digit = new bool[10];
- while (n > 0)
- {
- int cur = n % 10;
- if (digit[cur])
- return false;
- digit[cur] = true;
- n /= 10;
- }
- return true;
- }
- static void Main(string[] args)
- {
- Input cin = new Input();
- int n = cin.GetInt();
- int[][] a = new int[n][];
- for (int i = 0; i < n; ++i)
- a[i] = new int[n];
- int[] ans = new int[n];
- for (int i = 0; i < n; ++i)
- for (int j = 0; j < n; ++j)
- a[i][j] = cin.GetInt();
- for (int i = 0; i < n; ++i)
- for (int j = 0; j < n; ++j)
- {
- if (a[i][j] % 2 == 0)
- ans[i] = a[i][j];
- }
- for (int i = 0; i < n; ++i)
- Console.Write(ans[i] + " ");
- int m = cin.GetInt();
- int[] mas = new int[m];
- for (int i = 0; i < m; ++i)
- mas[i] = cin.GetInt();
- for (int i = 0; i < m; ++i)
- if (check(mas[i]))
- {
- for (int j = i; j < m - 1; ++j)
- mas[j] = mas[j + 1];
- m--; i--;
- }
- for (int i = 0; i < m; ++i)
- Console.Write(mas[i] + " ");
- int k = cin.GetInt();
- int[][] arr = new int[k][];
- for (int i = 0; i < k; ++i)
- arr[i] = new int[k];
- for (int i = 0; i < k; ++i)
- for (int j = 0; j < k; ++j)
- arr[j][i] = cin.GetInt();
- int save_k = k;
- for (int i = 0; i < k; ++i)
- {
- bool fl = true;
- for (int j = 0; j < save_k; ++j)
- if (arr[i][j] <= 0)
- {
- fl = false;
- break;
- }
- if (fl)
- {
- for (int j = i; j < k - 1; j++)
- arr[j] = arr[j + 1];
- k--; i--;
- }
- }
- Console.WriteLine();
- for (int i = 0; i < save_k; ++i)
- {
- for (int j = 0; j < k; ++j)
- Console.Write(arr[j][i] + " ");
- Console.WriteLine();
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment