Данный отчёт сгенерирован 04.04.2023 06:21:13 UTC.
HTML версия (этот сайт) сгенерирован 04.04.2023 06:21:31 UTC.
Коммит: [bfeb65b9] add automatic zip creation 04.04.2023 06:21:13
HTML версия (этот сайт) сгенерирован 04.04.2023 06:21:31 UTC.
Коммит: [bfeb65b9] add automatic zip creation 04.04.2023 06:21:13
Задача: Вставка Нулів
04.04.2023 06:21:13
Описание: Оголосити метод InsertZeroes(), який отримує непустий цілий масив із додатних чисел і повертає новий масив, в якому між чисел заданого масиву вставлені нулі.
Наприклад, {2, 3, 5} -> {2, 0, 3, 0, 5}.
04.04.2023 06:21:13
Решений: 80
04.04.2023 06:21:13
Вставка Нулів
04.04.2023 06:21:13
static int[] InsertZeroes(int[] m){
int[] array = new int[m.Length*2 - 1];
for ( int i = 0, j=0; i < array.Length; i+=1){
array[i] = i % 2 == 0 ? 0 : m[j];
}
return array;
}
static int[] InsertZeroes(int[] m)
{
var list = new List< int>();
foreach(var elem in m)
{
list.Add(elem);
list.Add(0);
}
return list.ToArray();
}
static int[] InsertZeroes(int[] m){
int[] arr = new int[m.Length*2 - 1];
for(int i = 0, j = 0; j < arr.Length; i++, j += 2){
arr[j] = m[i];
}
return arr;
}
static int[] InsertZeroes(int[] array)
{
int[] result = new int[array.Length * 2 - 1];
int j = 0;
for (int i = 0; i < array.Length; i++)
{
result[j++] = array[i];
if (i != array.Length - 1)
{
result[j++] = 0;
}
}
return result;
}
public static int[] InsertZeroes(int[] b)
{
List< int> res = new List< int>();
foreach (int i in b)
{
res.Add(i);
res.Add(0);
}
return res.ToArray();
}
static int[] InsertZeroes(int[] m){return m;}
static int[] InsertZeroes(int[] m){
int[] array = new int[m.Length * 2 - 1];
for(int i = 0; i < array.Length; i += 2){
if(i % 2 == 0){
array[i] = m[i / 2];
}
}
return array;
}
static int[] InsertZeroes(int[] m) {
return m;
}
static int[] InsertZeroes(int[] m) {
int[] array = new int[5];
for (int i = 0; i < m.Length; i++) {
int j = 2 * i;
array[j] = m[i];
Console.WriteLine(j);
if (i < m.Length - 1) {
array[j + 1] = 0;
}
}
return array;
}
// int[] x = {5, 6, 6};
// foreach(int n in InsertZeroes(x)) {
// Console.Write(n);
// }
static int[] InsertZeroes(int[] arr)
{
int[] arr1 = new int[arr.Length - arr.Length/2];
for(int i = 0, k = 0; i < arr1.Length; i++)
{
if(i%2 != 0) arr1[i] = 0;
else arr1[i] = arr[k];
k++;
}
return arr1;
}
static int[] InsertZeroes(int[] arr){
int[] arr2 = new int[arr.Length * 2 - 1];
for (int i = 0, j = 0; i < arr.Length; j += 2, i++) arr2[j] = arr[i];
return arr2;
}
static int[] InsertZeroes(int[] m)
{
int[] result = new int[m.Length + m.Length - 1];
int j = 0;
for (int i = 0; i < m.Length; i++)
{
result[j++] = m[i];
if (result.Length != j) result[j++] = 0;
}
return result;
}
public static int[] InsertZeroes(int[]m)
{
int[] arr = new int[m.Length*2-1];
for(int i=0; i<=m.Length-1; i++)
{
if(i%2==1)
{
arr[i] = 0;
}
}
return arr;
}
static int[] InsertZeroes(int[] m)
{
int[] Zeroed = new int[m.Length + m.Length - 1];
for (int i = 0; i< m.Length; i++)
{
Zeroed[i * 2] = m[i];
}
return Zeroed;
}
static int[] InsertZeroes(int[] m){
int[] arrey = new int[m.Length * 2];
int i = -1;
foreach(int j in m ){
arrey[++i] = j;
arrey[++i] = 0;
}
return arrey;
}
static int [] InsertZeroes(int [] m){
int [] newArr = new int [m.Length + m.Length-1];
for (int i = 0; i < m.Length; i++){
for (int j = 0; j < newArr.Length; j++){
if (j % 2 == 0) newArr[j] = m[i];
else newArr[j] = 0;
}
}
return newArr;
}
static int [] InsertZeroes(int[] m){
int[] arr;
if(m.Length % 2 == 0){
arr = new int[m.Length + m.Length / 2];
}
else{
arr = new int[m.Length + (int)Math.Floor(m.Length / 2.0)];
}
int count = 0;
for(int i = 0;i< arr.Length ;i++){
if (i % 2 == 1){
arr[i] = 0;
}
else{
arr[i] = m[count];
count++;
}
}
return arr;
}
static int[] InsertZeroes(int[] m){
int n = m.Length;
int[] arr = new int[n*2-1];
for(int i = 0; i < m.Length-1; i++){
arr[i * 2] = m[i];
arr[i * 2 + 1] = 0;
}
arr[(n - 1) * 2] = m[n - 1];
return arr;
}
public static int[] InsertZeroes(int[] arr) {
int n = arr.Length;
int[] result = new int[n * 2 - 1];
for (int i = 0; i < n; i++)
{
result[i * 2] = arr[i];
if (i < n - 1)
{
result[i * 2 + 1] = 0;
}
}
return result;
}
static int[] InsertZeroes(int[] m)
{
int[] result = new int[m.Length * 2 - 1];
int j = 0;
for (int i = 0;i < m.Length;i++)
{
result[j] = m[i];
j += 2;
}
return result;
}
static int[] InsertZeroes(int[] m){
int[] answ = new int[m.Length*2-1];
int c = 0;
foreach(int i in m){
answ[c] = i;
if(Array.IndexOf(m, i) != m.Length-1){answ[c+1] = 0;}
c+=2;
}
return answ;
}
static int [] InsertZeroes(int[] m)
{
int rizn = m.Length / 2;
int[] k = new int[m.Length+ rizn];
int t = 0;
for(int i=0; i< k.Length; i++)
{
if(i>0 && i%2==0)
{
t = m[i];
m[i] = 0;
k[i] = m[i];
i++;
k[i] = t;
}
}
return k;
}
static int[] InsertZeroes(int[] m) {
int[] arr = new int[m.Length * 2 - 1];
int j = 0;
for(int i=0; i< arr.Length; i++) {
if (i % 2 != 0) {
arr[i] = 0;
}
else {
arr[i] = m[j];
j++;
}
}
return arr;
}
static int[] InsertZeroes(int[] a)
{
int smeshenie=0;
int[] b = new int[a.Length*2-1];
for(int i=0;i< a.Length;i++)
{
b[i+smeshenie]=a[i];
if(i+smeshenie<=b.Length-2)
{
smeshenie++;
b[i+smeshenie]=0;
}
}
return b;
}
static int[] InsertZeroes(int[] arr)
{
int[] res = new int[arr.Length * 2 - 1];
res[0] = arr[0];
for (int i = 1, j = 1; i < arr.Length; i++, j += 2)
{
res[j] = arr[i];
res[j + 1] = 0;
}
return res;
}
static int[] InsertZeroes(int[] nums)
{
int n = nums.Length;
int[] result = new int[n + (n - 1)];
for (int i = 0; i < n; i++)
{
result[i*2] = nums[i];
if (i != n - 1)
{
result[i*2+1] = 0;
}
}
return result;
}
static int[] InsertZeroes(int[] array)
{
int[] arr = new int[2 * array.Length - 1];
for (int i = 0; i < arr.Length - 1;)
{
for (int j = 0; j < array.Length - 1; j++)
{
arr[i] = array[j];
arr[i + 1] = 0;
i += 2;
}
}
arr[arr.Length - 1] = array[array.Length - 1];
return arr;
}
static int[] InsertZeroes(int[] arrPos)
{
int[] arrZero = new int[arrPos.Length + arrPos.Length - 1];
for (int i = 0, j = 0; i < arrPos.Length; i++)
{
arrZero[j] = arrPos[i];
if (i == arrPos.Length - 1)
{
break;
}
j++;
arrZero[j] = 0;
}
return arrZero;
}
static int[] InsertZeroes(int[] arr) {
int[] result = new int[arr.Length*2-1];
result[0] = arr[0];
for(int i = 1; i < arr.Length; i++) {
result[i*2-1] = 0;
result[i*2] = arr[i];
}
return result;
}
public static int[] InsertZeroes(int[] arr)
{
int n = arr.Length;
int[] result = new int[2 * n - 1];
for (int i = 0; i < n; i++)
{
result[2 * i] = arr[i];
if (i < n - 1)
{
result[2 * i + 1] = 0;
}
}
return result;
}
static int[] InsertZeroes(int[] m)
{
int[] result = new int[2 * m.Length - 1];
for (int i = 0; i < m.Length; i++)
{
result[2 * i] = m[i];
if (i < m.Length - 1)
{
result[2 * i + 1] = 0;
}
}
return result;
}
static int[] InsertZeroes(int[] m){
int[] arr = new int[m.Length * 2 -1];
int pointer = 0;
for(int i = 0; i < m.Length; i++){
arr[pointer] = m[i];
pointer++;
if(pointer == m.Length){
break;
}
else if(i != arr.Length -1 )
arr[pointer] = 0;
pointer++;
}
return arr;
}
static int[] InsertZeroes(int[] n)
{
int ml = n.Length + (n.Length / 2);
int[] m = new int[ml];
for (int i = 0, j = 0; i < ml; i++)
{
if (i % 3 == 0)
{
m[i] = 0;
}
else
{
m[i] = n[j];
j++;
}
}
return m;
}
static int[] InsertZeroes(int[] m){
int[] res = new int[m.Length*2-1];
res[0]=m[0];
for (int i=1; i< m.Length; i++){
res[i*2-1]=0;
res[i*2]=m[i];
}
return res;
}
static int[] InsertZeroes(int[] m1)
{
int[] m2 = new int[m1.Length*2 - 1];
for(int i = 0, j = 0;j < m2.Length; i++, j += 2)
{
if(j != m2.Length - 1)
{
m2[j + 1] = 0;
}
else
{
m2[j] = m1[i];
}
}
return m2;
}
static int[] InsertZeroes(int[] m){
int[] result = new int[m.Length + m.Length - 1];
for(int i = 0, j = 0; i< result.Length;i++){
if(i%2 == 0){
result[i] = m[j];
j++;
}
else{
result[i] = 0;
}
}
return result;
}
static int[] InsertZeroes(int[] n)
{
int[] pop = new int[(n.Length*2)-1];
for (int i = 0, k = 0; i < pop.Length; i = i + 2, k++) {
pop[i] = n[k];
}
return pop;
}
static int[] InsertZeroes(int[] m)
{
int[] newArr = new int[m.Length * 2 - 1];
for (int i = 0; i < m.Length; i++)
{
newArr[i * 2] = m[i];
if (i < m.Length - 1)
{
newArr[i * 2 + 1] = 0;
}
}
return newArr;
}
static int[] InsertZeroes(int[] arr)
{
int[] array = new int[arr.Length * 2 - 1];
for (int i = 0, j = 0; j < arr.Length; i += 2, j++)
{
array[i] = arr[j];
}
return array;
}
static int[] InsertZeroes(int[] m){
int[] arr = new int[(m.Length*2)-1];
for(int i = 0; i < m.Length; i++){
for(int j = 0; j< arr.Length-1;j++){
arr[j]=m[i];
arr[j+1]=0;
}}
return arr;
}
static int[] InsertZeroes(int[] m){
int[] m2=new int[m.Length*2];
int i=0;
for (int j=0; j< m.Length; j++){
m2[i]=m[j];
i++;
if (j< m.Length-1){
m2[i]=0;
i++;
}
}
return m2;
}
static int[] InsertZeroes(int[] m){
int[] arr = new int[m.Length+(m.Length-1)];
for (int i = 0,j = 0; i < m.Length; i++,j+=2)
{
arr[j] = m[i];
}
return arr;
}
static int[] InsertZeroes(int[] m) {
int[] array = new int[m.Length * 2 - 1];
int i = 0;
int j = 0;
while (j < m.Length - 1) {
array[i] = m[j];
array[i + 1] = 0;
i += 2;
j++;
}
return array;
}
static int[] InsertZeroes(int[] arr)
{
int[] res = new int[arr.Length + arr.Length - 1];
for (int i = 0, j = 0; i < res.Length && j < arr.Length; i++)
{
res[i] = arr[j]; j++;
if (i != res.Length - 1) { i++; continue; }
}
return res;
}
static int[] InsertZeroes(int[] m)
{
int[] arr = new int[m.Length*2-1];
for (int a = 0,n=0; n < m.Length; a+=2,n++)
arr[a] = m[n];
return arr;
}
static int[] InsertZeroes(int[] m)
{
int[] temp= new int[m.Length*2-1];
for(int i = 0; i < m.Length; i+=2)
{
temp[i] = m[i / 2];
}
return temp;
}
static int[] InsertZeroes(int[] m)
{
int[] x = new int[m.Length*2 - 1];
for (int i = 0; i < m.Length-1; i++)
{
x[2*i] = m[i];
}
return x;
}
static int[] InsertZeroes(int[] m){
int[] arr = new int[m.Length*2 - 1];
for(int i = 0, j = 0; j < arr.Length; j++){
if (i % 2 == 0) arr[j]=m[i];
else
{
arr[j]=0;
i++;
}
}
return arr;
}
static int[] InsertZeroes(int[] m){
int[] arr = new int[m.Length+m.Length-1];
for ( int i = 0, j=0; i< arr.Length; i++){
if (i%2 != 0){
arr[i] = 0;
}
else{
arr[i] = m[j];
}
}
return arr;
}
static int[] InsertZeroes(int[] m){
int[] arrey = new int[m.Length * 2];
int i = -1;
foreach(int j in m ){
arrey[++i] = j;
arrey[++i] = 0;
}
return arrey;
}
static int[] InsertZeroes(int[] m)
{
int[] arr = new int[2 * m.Length - 1];
for (int i = 0; i < m.Length; i++)
{
arr[i * 2] = m[i];
if (i < m.Length - 1)
{
arr[i * 2 + 1] = 0;
}
}
return arr;
}
static int[] InsertZeroes(int[] m) {
for(int i = 0; i < m.Length; i++){
m[i] = 0;
}
return m;
}
static int[] InsertZeroes(int[] m){
int[] res = new int[m.Length*2-1];
for(int i=0,j=0;j< res.Length;i++,j+=2){
res[j]=m[i];
}
for(int i=1;i< res.Length-1;i++){
res[i]=0;
}
return res;
}
static int[] InsertZeroes(int[] m)
{
int[] arr = new int[m.Length*2-1];
for(int i = 0; i < m.Length; i++)
{
arr[i*2] = m[i];
}
return arr;
}
public static int[] InsertZeroes(int[] arr)
{
int[] array = new int[2 * arr.Length - 1];
int j = 0;
for (int i = 0; i < arr.Length; i++)
{
array[j] = arr[i];
if (i < arr.Length - 1)
{
j++;
array[j] = 0;
}
j++;
}
return array;
}
public static int[] InsertZeroes(int[] arr)
{
int len = arr.Length;
int[] result = new int[len * 2 - 1];
int j = 0;
for (int i = 0; i < len; i++)
{
result[j++] = arr[i];
if (i < len - 1)
{
result[j++] = 0;
}
}
return result;
}
static int[] InsertZeroes(int[] array)
{
int[] set = new int[array.Length*2-1];
set[0] = array[0]; set[^1] = array[^1];
for (int i = 2; i < set.Length-2; i += 2)
set[i] = array[i/2];
return set;
}
static int[] InsertZeroes(int[] array) {
/*
░░░░░░░░░░░░░░░░░░░░░░█████████
░░███████░░░░░░░░░░███▒▒▒▒▒▒▒▒███
░░█▒▒▒▒▒▒█░░░░░░░███▒▒▒▒▒▒▒▒▒▒▒▒▒███
░░░█▒▒▒▒▒▒█░░░░██▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒██
░░░░█▒▒▒▒▒█░░░██▒▒▒▒▒██▒▒▒▒▒▒██▒▒▒▒▒███
░░░░░█▒▒▒█░░░█▒▒▒▒▒▒████▒▒▒▒████▒▒▒▒▒▒██
░░░█████████████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒██
░░░█▒▒▒▒▒▒▒▒▒▒▒▒█▒▒▒▒▒▒▒▒▒█▒▒▒▒▒▒▒▒▒▒▒██
░██▒▒▒▒▒▒▒▒▒▒▒▒▒█▒▒▒██▒▒▒▒▒▒▒▒▒▒██▒▒▒▒██
██▒▒▒███████████▒▒▒▒▒██▒▒▒▒▒▒▒▒██▒▒▒▒▒██
█▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒█▒▒▒▒▒▒████████▒▒▒▒▒▒▒██
██▒▒▒▒▒▒▒▒▒▒▒▒▒▒█▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒██
░█▒▒▒███████████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒██
░██▒▒▒▒▒▒▒▒▒▒████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒█
░░████████████░░░█████████████████
*/
int[] puffy = new int[array.Length * 2 - 1];
for (int i = 0; i < puffy.Length; i++) {
if (i % 2 == 0) {
puffy[i] = array[i / 2];
} else {
puffy[i] = 0;
}
}
return puffy;
}
public static int[] InsertZeroes(int[] arr)
{
int newLength = arr.Length * 2 - 1;
int[] newArr = new int[newLength];
for (int i = 0; i < arr.Length; i++)
{
newArr[i * 2] = arr[i];
if (i < arr.Length - 1)
{
newArr[i * 2 + 1] = 0;
}
}
return newArr;
}
static int[] InsertZeroes(int[] m){
int[] arr = new int[m.Length*2-1];
for(int i=0,j=0;j< arr.Length;i++,j+=2){
arr[j]=m[i];
}
return arr;
}
static int[] InsertZeroes(int[] m)
{
int[] result = new int[m.Length * 2 - 1];
for (int i = 0; i < m.Length; i++)
{
result[i * 2] = m[i];
if (i != m.Length - 1)
{
result[i * 2 + 1] = 0;
}
}
return result;
}
static int[] InsertZeroes(int[] m){
int[] array = new int[m.Length+m.Length-1];
int count = 0;
for(int i=0; i< array.Length; i++) {
if (i % 2 != 0) {
array[i] = 0;
}
else {
array[i] = m[count];
count++;
}
}
return array;
}
static int[] InsertZeroes(int[] arr1)
{
int[] arr2 = new int[2 * arr1.Length - 1];
for (int i = 0, j = 0; i < arr2.Length; i += 2, j++)
{
arr2[i] = arr1[j];
}
return arr2;
}
static int[] InsertZeroes(int[] m){
int[] n = new int[m.Length * 2 - 1];
for(int i = 0, j = 0; i < m.Length; i++, j += 2)
{
n[j] = m[i];
if(i != m.Length - 1)
n[j + 1] = 0;
}
return n;
}
static int[] InsertZeroes(int[] m)
{
int[] a = new int[(m.Length*2)-1];
for(int i = 0; i< m.Length-1; i+=2)
{
a[i] = m[i];
a[i+1] = 0;
}
return a;
}
static int[] InsertZeroes(int[] m)
{
List< int> temp = new List< int>(m);
for (int i = 1, j = 0; j < m.Length - 1; i += 2, j++){
temp.Insert(i,0);
}
int[] array = new int[temp.Count];
for (int i = 0; i < temp.Count; i++){
array[i] = temp[i];
}
return array;
}
static public int[] InsertZeroes(int[] m) {
int[] arr = new int[m.Length + m.Length - 1];
for (int i = 0; i < m.Length; i++) {
if (i != m.Length - 1) {
arr[i * 2] = m[i];
arr[i * 2 + 1] = 0;
} else {
arr[i * 2] = m[i];
}
}
return arr;
}
static int[] InsertZeroes(int[] m){
int[] n= new int[2*m.Length-1];
for(int i=0; i< m.Length; i++){
n[2*i]=m[i];
}
return n;
}
public static int[] InsertZeroes(int[] arr)
{
int[] result = new int[arr.Length * 2 - 1];
for (int i = 0, j = 0; i < arr.Length; i++, j += 2)
{
result[j] = arr[i];
if (i < arr.Length - 1)
{
result[j + 1] = 0;
}
}
return result;
}
static int[] InsertZeroes(int[] arr)
{
var newArr = new int[2*arr.Length - 1];
for(int i = 0; i < arr.Length; i+= 2)
{
newArr[i] = arr[i];
}
return newArr;
}
static int[] InsertZeroes(int[] m){
int[] a = new int[m.Length];
int z = 0;
for (int i = 0; i < a.Length; i++)
a[i] = z;
return a;
}
public static int[] InsertZeroes(int[] arr){
int[] result = new int[arr.Length * 2 - 1];
for (int i = 0, j = 0; i < arr.Length; i++, j += 2){
result[j] = arr[i];
if (i < arr.Length - 1){
result[j + 1] = 0;
}
}
return result;
}
static int[] InsertZeroes(int[] m)
{
int[] a = new int[2 * m.Length - 1];
for (int i = 0; i < m.Length; i++)
{
a[2 * i] = m[i];
if (i < m.Length - 1) a[2 * i + 1] = 0;
}
return a;
}
static int[] InsertZeroes(int[] arr)
{
int[] newarr = new int[arr.Length*2-1];
newarr[0] = arr[0];
int q = 1;
for(int i = 1;i< arr.Length;i++)
{
newarr[q] = arr[i];
q+=2;
}
return newarr;
}
static int[] InsertZeroes(int[] m) {
int[] newArr = new int[m.Length*2];
for (int i = 0, j = 1; i < m.Length; i+=2, j+=2) {
newArr[i] = m[i/2];
newArr[j] = 0;
}
return newArr;
}
static int[] InsertZeroes(int[] m){
int[] arrey = new int [m.Length * 2];
int i = -1;
foreach(int j in m){
arrey[++i] = j;
arrey[++i] = 0;
}
return arrey;
}
static int[] InsertZeroes(int[] m){
int count = 0 ;
int[] array = new int[m.Length+m.Length-1];
for(int i = 0; i< m.Length-2;i+=2){
array[i]=m[i-count];
array[i+1]=0;
count+=1;
}
return array;
}
static int[] InsertZeroes(int[] arr)
{
int[] arr2 = new int[arr.Length + (arr.Length-1)];
int arrIndex = 0;
for (int i = 0; i < arr2.Length; i++)
{
if(i % 2 == 0)
{
arr2[i] = arr[arrIndex];
arrIndex++;
}
else
{
arr2[i] = 0;
}
}
return arr2;
}
static int[] InsertZeroes(int[] m){
int[] arr = new int[m.Length * 2 - 1];
for(int j = 0, k = 0; k < m.Length; j += 2, k++){
arr[j] = m[k];
}
return arr;
}
static int[] InsertZeroes(int[] input)
{
int[] new_array = new int[(int)Math.Ceiling(input.Length * 1.5)];
for(int i = 0; i < new_array.Length; i++)
{
new_array[i] = i % 2 == 0? input[i / 2] : 0;
}
return new_array;
}
int[] array = new int[m.Length*2 - 1];
for ( int i = 0, j=0; i < array.Length; i+=1){
array[i] = i % 2 == 0 ? 0 : m[j];
}
return array;
}
{
var list = new List< int>();
foreach(var elem in m)
{
list.Add(elem);
list.Add(0);
}
return list.ToArray();
}
int[] arr = new int[m.Length*2 - 1];
for(int i = 0, j = 0; j < arr.Length; i++, j += 2){
arr[j] = m[i];
}
return arr;
}
{
int[] result = new int[array.Length * 2 - 1];
int j = 0;
for (int i = 0; i < array.Length; i++)
{
result[j++] = array[i];
if (i != array.Length - 1)
{
result[j++] = 0;
}
}
return result;
}
{
List< int> res = new List< int>();
foreach (int i in b)
{
res.Add(i);
res.Add(0);
}
return res.ToArray();
}
int[] array = new int[m.Length * 2 - 1];
for(int i = 0; i < array.Length; i += 2){
if(i % 2 == 0){
array[i] = m[i / 2];
}
}
return array;
}
return m;
}
int[] array = new int[5];
for (int i = 0; i < m.Length; i++) {
int j = 2 * i;
array[j] = m[i];
Console.WriteLine(j);
if (i < m.Length - 1) {
array[j + 1] = 0;
}
}
return array;
}
// int[] x = {5, 6, 6};
// foreach(int n in InsertZeroes(x)) {
// Console.Write(n);
// }
{
int[] arr1 = new int[arr.Length - arr.Length/2];
for(int i = 0, k = 0; i < arr1.Length; i++)
{
if(i%2 != 0) arr1[i] = 0;
else arr1[i] = arr[k];
k++;
}
return arr1;
}
int[] arr2 = new int[arr.Length * 2 - 1];
for (int i = 0, j = 0; i < arr.Length; j += 2, i++) arr2[j] = arr[i];
return arr2;
}
{
int[] result = new int[m.Length + m.Length - 1];
int j = 0;
for (int i = 0; i < m.Length; i++)
{
result[j++] = m[i];
if (result.Length != j) result[j++] = 0;
}
return result;
}
{
int[] arr = new int[m.Length*2-1];
for(int i=0; i<=m.Length-1; i++)
{
if(i%2==1)
{
arr[i] = 0;
}
}
return arr;
}
{
int[] Zeroed = new int[m.Length + m.Length - 1];
for (int i = 0; i< m.Length; i++)
{
Zeroed[i * 2] = m[i];
}
return Zeroed;
}
int[] arrey = new int[m.Length * 2];
int i = -1;
foreach(int j in m ){
arrey[++i] = j;
arrey[++i] = 0;
}
return arrey;
}
int [] newArr = new int [m.Length + m.Length-1];
for (int i = 0; i < m.Length; i++){
for (int j = 0; j < newArr.Length; j++){
if (j % 2 == 0) newArr[j] = m[i];
else newArr[j] = 0;
}
}
return newArr;
}
int[] arr;
if(m.Length % 2 == 0){
arr = new int[m.Length + m.Length / 2];
}
else{
arr = new int[m.Length + (int)Math.Floor(m.Length / 2.0)];
}
int count = 0;
for(int i = 0;i< arr.Length ;i++){
if (i % 2 == 1){
arr[i] = 0;
}
else{
arr[i] = m[count];
count++;
}
}
return arr;
}
int n = m.Length;
int[] arr = new int[n*2-1];
for(int i = 0; i < m.Length-1; i++){
arr[i * 2] = m[i];
arr[i * 2 + 1] = 0;
}
arr[(n - 1) * 2] = m[n - 1];
return arr;
}
int n = arr.Length;
int[] result = new int[n * 2 - 1];
for (int i = 0; i < n; i++)
{
result[i * 2] = arr[i];
if (i < n - 1)
{
result[i * 2 + 1] = 0;
}
}
return result;
}
{
int[] result = new int[m.Length * 2 - 1];
int j = 0;
for (int i = 0;i < m.Length;i++)
{
result[j] = m[i];
j += 2;
}
return result;
}
int[] answ = new int[m.Length*2-1];
int c = 0;
foreach(int i in m){
answ[c] = i;
if(Array.IndexOf(m, i) != m.Length-1){answ[c+1] = 0;}
c+=2;
}
return answ;
}
{
int rizn = m.Length / 2;
int[] k = new int[m.Length+ rizn];
int t = 0;
for(int i=0; i< k.Length; i++)
{
if(i>0 && i%2==0)
{
t = m[i];
m[i] = 0;
k[i] = m[i];
i++;
k[i] = t;
}
}
return k;
}
int[] arr = new int[m.Length * 2 - 1];
int j = 0;
for(int i=0; i< arr.Length; i++) {
if (i % 2 != 0) {
arr[i] = 0;
}
else {
arr[i] = m[j];
j++;
}
}
return arr;
}
{
int smeshenie=0;
int[] b = new int[a.Length*2-1];
for(int i=0;i< a.Length;i++)
{
b[i+smeshenie]=a[i];
if(i+smeshenie<=b.Length-2)
{
smeshenie++;
b[i+smeshenie]=0;
}
}
return b;
}
{
int[] res = new int[arr.Length * 2 - 1];
res[0] = arr[0];
for (int i = 1, j = 1; i < arr.Length; i++, j += 2)
{
res[j] = arr[i];
res[j + 1] = 0;
}
return res;
}
{
int n = nums.Length;
int[] result = new int[n + (n - 1)];
for (int i = 0; i < n; i++)
{
result[i*2] = nums[i];
if (i != n - 1)
{
result[i*2+1] = 0;
}
}
return result;
}
{
int[] arr = new int[2 * array.Length - 1];
for (int i = 0; i < arr.Length - 1;)
{
for (int j = 0; j < array.Length - 1; j++)
{
arr[i] = array[j];
arr[i + 1] = 0;
i += 2;
}
}
arr[arr.Length - 1] = array[array.Length - 1];
return arr;
}
{
int[] arrZero = new int[arrPos.Length + arrPos.Length - 1];
for (int i = 0, j = 0; i < arrPos.Length; i++)
{
arrZero[j] = arrPos[i];
if (i == arrPos.Length - 1)
{
break;
}
j++;
arrZero[j] = 0;
}
return arrZero;
}
int[] result = new int[arr.Length*2-1];
result[0] = arr[0];
for(int i = 1; i < arr.Length; i++) {
result[i*2-1] = 0;
result[i*2] = arr[i];
}
return result;
}
{
int n = arr.Length;
int[] result = new int[2 * n - 1];
for (int i = 0; i < n; i++)
{
result[2 * i] = arr[i];
if (i < n - 1)
{
result[2 * i + 1] = 0;
}
}
return result;
}
{
int[] result = new int[2 * m.Length - 1];
for (int i = 0; i < m.Length; i++)
{
result[2 * i] = m[i];
if (i < m.Length - 1)
{
result[2 * i + 1] = 0;
}
}
return result;
}
int[] arr = new int[m.Length * 2 -1];
int pointer = 0;
for(int i = 0; i < m.Length; i++){
arr[pointer] = m[i];
pointer++;
if(pointer == m.Length){
break;
}
else if(i != arr.Length -1 )
arr[pointer] = 0;
pointer++;
}
return arr;
}
{
int ml = n.Length + (n.Length / 2);
int[] m = new int[ml];
for (int i = 0, j = 0; i < ml; i++)
{
if (i % 3 == 0)
{
m[i] = 0;
}
else
{
m[i] = n[j];
j++;
}
}
return m;
}
int[] res = new int[m.Length*2-1];
res[0]=m[0];
for (int i=1; i< m.Length; i++){
res[i*2-1]=0;
res[i*2]=m[i];
}
return res;
}
{
int[] m2 = new int[m1.Length*2 - 1];
for(int i = 0, j = 0;j < m2.Length; i++, j += 2)
{
if(j != m2.Length - 1)
{
m2[j + 1] = 0;
}
else
{
m2[j] = m1[i];
}
}
return m2;
}
int[] result = new int[m.Length + m.Length - 1];
for(int i = 0, j = 0; i< result.Length;i++){
if(i%2 == 0){
result[i] = m[j];
j++;
}
else{
result[i] = 0;
}
}
return result;
}
{
int[] pop = new int[(n.Length*2)-1];
for (int i = 0, k = 0; i < pop.Length; i = i + 2, k++) {
pop[i] = n[k];
}
return pop;
}
{
int[] newArr = new int[m.Length * 2 - 1];
for (int i = 0; i < m.Length; i++)
{
newArr[i * 2] = m[i];
if (i < m.Length - 1)
{
newArr[i * 2 + 1] = 0;
}
}
return newArr;
}
{
int[] array = new int[arr.Length * 2 - 1];
for (int i = 0, j = 0; j < arr.Length; i += 2, j++)
{
array[i] = arr[j];
}
return array;
}
int[] arr = new int[(m.Length*2)-1];
for(int i = 0; i < m.Length; i++){
for(int j = 0; j< arr.Length-1;j++){
arr[j]=m[i];
arr[j+1]=0;
}}
return arr;
}
int[] m2=new int[m.Length*2];
int i=0;
for (int j=0; j< m.Length; j++){
m2[i]=m[j];
i++;
if (j< m.Length-1){
m2[i]=0;
i++;
}
}
return m2;
}
int[] arr = new int[m.Length+(m.Length-1)];
for (int i = 0,j = 0; i < m.Length; i++,j+=2)
{
arr[j] = m[i];
}
return arr;
}
int[] array = new int[m.Length * 2 - 1];
int i = 0;
int j = 0;
while (j < m.Length - 1) {
array[i] = m[j];
array[i + 1] = 0;
i += 2;
j++;
}
return array;
}
{
int[] res = new int[arr.Length + arr.Length - 1];
for (int i = 0, j = 0; i < res.Length && j < arr.Length; i++)
{
res[i] = arr[j]; j++;
if (i != res.Length - 1) { i++; continue; }
}
return res;
}
{
int[] arr = new int[m.Length*2-1];
for (int a = 0,n=0; n < m.Length; a+=2,n++)
arr[a] = m[n];
return arr;
}
{
int[] temp= new int[m.Length*2-1];
for(int i = 0; i < m.Length; i+=2)
{
temp[i] = m[i / 2];
}
return temp;
}
{
int[] x = new int[m.Length*2 - 1];
for (int i = 0; i < m.Length-1; i++)
{
x[2*i] = m[i];
}
return x;
}
int[] arr = new int[m.Length*2 - 1];
for(int i = 0, j = 0; j < arr.Length; j++){
if (i % 2 == 0) arr[j]=m[i];
else
{
arr[j]=0;
i++;
}
}
return arr;
}
int[] arr = new int[m.Length+m.Length-1];
for ( int i = 0, j=0; i< arr.Length; i++){
if (i%2 != 0){
arr[i] = 0;
}
else{
arr[i] = m[j];
}
}
return arr;
}
int[] arrey = new int[m.Length * 2];
int i = -1;
foreach(int j in m ){
arrey[++i] = j;
arrey[++i] = 0;
}
return arrey;
}
{
int[] arr = new int[2 * m.Length - 1];
for (int i = 0; i < m.Length; i++)
{
arr[i * 2] = m[i];
if (i < m.Length - 1)
{
arr[i * 2 + 1] = 0;
}
}
return arr;
}
for(int i = 0; i < m.Length; i++){
m[i] = 0;
}
return m;
}
int[] res = new int[m.Length*2-1];
for(int i=0,j=0;j< res.Length;i++,j+=2){
res[j]=m[i];
}
for(int i=1;i< res.Length-1;i++){
res[i]=0;
}
return res;
}
{
int[] arr = new int[m.Length*2-1];
for(int i = 0; i < m.Length; i++)
{
arr[i*2] = m[i];
}
return arr;
}
{
int[] array = new int[2 * arr.Length - 1];
int j = 0;
for (int i = 0; i < arr.Length; i++)
{
array[j] = arr[i];
if (i < arr.Length - 1)
{
j++;
array[j] = 0;
}
j++;
}
return array;
}
{
int len = arr.Length;
int[] result = new int[len * 2 - 1];
int j = 0;
for (int i = 0; i < len; i++)
{
result[j++] = arr[i];
if (i < len - 1)
{
result[j++] = 0;
}
}
return result;
}
{
int[] set = new int[array.Length*2-1];
set[0] = array[0]; set[^1] = array[^1];
for (int i = 2; i < set.Length-2; i += 2)
set[i] = array[i/2];
return set;
}
/*
░░░░░░░░░░░░░░░░░░░░░░█████████
░░███████░░░░░░░░░░███▒▒▒▒▒▒▒▒███
░░█▒▒▒▒▒▒█░░░░░░░███▒▒▒▒▒▒▒▒▒▒▒▒▒███
░░░█▒▒▒▒▒▒█░░░░██▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒██
░░░░█▒▒▒▒▒█░░░██▒▒▒▒▒██▒▒▒▒▒▒██▒▒▒▒▒███
░░░░░█▒▒▒█░░░█▒▒▒▒▒▒████▒▒▒▒████▒▒▒▒▒▒██
░░░█████████████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒██
░░░█▒▒▒▒▒▒▒▒▒▒▒▒█▒▒▒▒▒▒▒▒▒█▒▒▒▒▒▒▒▒▒▒▒██
░██▒▒▒▒▒▒▒▒▒▒▒▒▒█▒▒▒██▒▒▒▒▒▒▒▒▒▒██▒▒▒▒██
██▒▒▒███████████▒▒▒▒▒██▒▒▒▒▒▒▒▒██▒▒▒▒▒██
█▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒█▒▒▒▒▒▒████████▒▒▒▒▒▒▒██
██▒▒▒▒▒▒▒▒▒▒▒▒▒▒█▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒██
░█▒▒▒███████████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒██
░██▒▒▒▒▒▒▒▒▒▒████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒█
░░████████████░░░█████████████████
*/
int[] puffy = new int[array.Length * 2 - 1];
for (int i = 0; i < puffy.Length; i++) {
if (i % 2 == 0) {
puffy[i] = array[i / 2];
} else {
puffy[i] = 0;
}
}
return puffy;
}
{
int newLength = arr.Length * 2 - 1;
int[] newArr = new int[newLength];
for (int i = 0; i < arr.Length; i++)
{
newArr[i * 2] = arr[i];
if (i < arr.Length - 1)
{
newArr[i * 2 + 1] = 0;
}
}
return newArr;
}
int[] arr = new int[m.Length*2-1];
for(int i=0,j=0;j< arr.Length;i++,j+=2){
arr[j]=m[i];
}
return arr;
}
{
int[] result = new int[m.Length * 2 - 1];
for (int i = 0; i < m.Length; i++)
{
result[i * 2] = m[i];
if (i != m.Length - 1)
{
result[i * 2 + 1] = 0;
}
}
return result;
}
int[] array = new int[m.Length+m.Length-1];
int count = 0;
for(int i=0; i< array.Length; i++) {
if (i % 2 != 0) {
array[i] = 0;
}
else {
array[i] = m[count];
count++;
}
}
return array;
}
{
int[] arr2 = new int[2 * arr1.Length - 1];
for (int i = 0, j = 0; i < arr2.Length; i += 2, j++)
{
arr2[i] = arr1[j];
}
return arr2;
}
int[] n = new int[m.Length * 2 - 1];
for(int i = 0, j = 0; i < m.Length; i++, j += 2)
{
n[j] = m[i];
if(i != m.Length - 1)
n[j + 1] = 0;
}
return n;
}
{
int[] a = new int[(m.Length*2)-1];
for(int i = 0; i< m.Length-1; i+=2)
{
a[i] = m[i];
a[i+1] = 0;
}
return a;
}
{
List< int> temp = new List< int>(m);
for (int i = 1, j = 0; j < m.Length - 1; i += 2, j++){
temp.Insert(i,0);
}
int[] array = new int[temp.Count];
for (int i = 0; i < temp.Count; i++){
array[i] = temp[i];
}
return array;
}
int[] arr = new int[m.Length + m.Length - 1];
for (int i = 0; i < m.Length; i++) {
if (i != m.Length - 1) {
arr[i * 2] = m[i];
arr[i * 2 + 1] = 0;
} else {
arr[i * 2] = m[i];
}
}
return arr;
}
int[] n= new int[2*m.Length-1];
for(int i=0; i< m.Length; i++){
n[2*i]=m[i];
}
return n;
}
{
int[] result = new int[arr.Length * 2 - 1];
for (int i = 0, j = 0; i < arr.Length; i++, j += 2)
{
result[j] = arr[i];
if (i < arr.Length - 1)
{
result[j + 1] = 0;
}
}
return result;
}
{
var newArr = new int[2*arr.Length - 1];
for(int i = 0; i < arr.Length; i+= 2)
{
newArr[i] = arr[i];
}
return newArr;
}
int[] a = new int[m.Length];
int z = 0;
for (int i = 0; i < a.Length; i++)
a[i] = z;
return a;
}
int[] result = new int[arr.Length * 2 - 1];
for (int i = 0, j = 0; i < arr.Length; i++, j += 2){
result[j] = arr[i];
if (i < arr.Length - 1){
result[j + 1] = 0;
}
}
return result;
}
{
int[] a = new int[2 * m.Length - 1];
for (int i = 0; i < m.Length; i++)
{
a[2 * i] = m[i];
if (i < m.Length - 1) a[2 * i + 1] = 0;
}
return a;
}
{
int[] newarr = new int[arr.Length*2-1];
newarr[0] = arr[0];
int q = 1;
for(int i = 1;i< arr.Length;i++)
{
newarr[q] = arr[i];
q+=2;
}
return newarr;
}
int[] newArr = new int[m.Length*2];
for (int i = 0, j = 1; i < m.Length; i+=2, j+=2) {
newArr[i] = m[i/2];
newArr[j] = 0;
}
return newArr;
}
int[] arrey = new int [m.Length * 2];
int i = -1;
foreach(int j in m){
arrey[++i] = j;
arrey[++i] = 0;
}
return arrey;
}
int count = 0 ;
int[] array = new int[m.Length+m.Length-1];
for(int i = 0; i< m.Length-2;i+=2){
array[i]=m[i-count];
array[i+1]=0;
count+=1;
}
return array;
}
{
int[] arr2 = new int[arr.Length + (arr.Length-1)];
int arrIndex = 0;
for (int i = 0; i < arr2.Length; i++)
{
if(i % 2 == 0)
{
arr2[i] = arr[arrIndex];
arrIndex++;
}
else
{
arr2[i] = 0;
}
}
return arr2;
}
int[] arr = new int[m.Length * 2 - 1];
for(int j = 0, k = 0; k < m.Length; j += 2, k++){
arr[j] = m[k];
}
return arr;
}
{
int[] new_array = new int[(int)Math.Ceiling(input.Length * 1.5)];
for(int i = 0; i < new_array.Length; i++)
{
new_array[i] = i % 2 == 0? input[i / 2] : 0;
}
return new_array;
}