sacredand
06.10.2021 08:11

Сколько существует натуральных чисел N, для которых выполняется неравенство 101000002

Нажмите на рекламу ниже и сразу увидите ответ
Популярные вопросы:
Ответ:
Юся1809
16.12.2021 01:54
#include<iostream>
#include<cstdlib>
#include<ctime>

#define abs(x) ((x)<0 ? -(x) : (x))
using namespace std;
int main()
{
    srand(time(0));
    int n, k, m = 0;
    cout << "n = ", cin >> n;
    
    int A[n], B[n];
    cout <<"A("<<n<<"):";
    for(int i = 0; i < n; i++)
        cout <<" "<< (A[i] = rand() % (n*2+1) -n);
    
    cout << "\nk = ", cin >> k;
    
    for(int i = 0; i < n; i++)
        if (abs(A[i]) % 10 == k) B[m++] = A[i];
    
    cout <<"B("<<m<<"):";
    for(int i = 0; i < m; i++)
        cout <<" "<< B[i];
    return 0;
}
0,0(0 оценок)
Ответ:
Jika030302
27.12.2022 06:18

// C# 7.3

using System;

using System.Collections.Generic;

using System.Collections;

using System.Text;

namespace Rextester

{

   public class Program

   {

       public static void Main(string[] args)

       {

           var crypted = "";

 

           for (int i = 0; i < CaesarCipher.Ru.Length; i++)

               Console.WriteLine(CaesarCipher.Decode(i, crypted));

       }

   }

   

   class CaesarCipher

   {

       public static readonly string Ru = "";

       public static readonly string RuD = "";

       private static readonly int defaultStep = 3;

       public static CaesarEncrypted Encode(int step, string source, Func<string, string> translate)

       {

           string translatedData = translate(source);

           var stringBuilder = new StringBuilder();

           foreach (char c in translatedData.ToLower())

           {

               stringBuilder.Append(RuD[Ru.IndexOf(c) + step]);

           }

           return new CaesarEncrypted(step, stringBuilder.ToString());

       }

       public static CaesarEncrypted Encode(int step, string source)

       {

           return Encode(step, source, x => x);

       }

       public static string Decode(CaesarEncrypted source)

       {

           var step = source.Step;

           return Encode(-step + Ru.Length, source.ToString(), x => x);

       }

       public static string Decode(int step, string source)

       {

           return Encode(-step + Ru.Length, source, x => x);

       }

   }

   class CaesarEncrypted : IEnumerable, IEnumerable<char>

   {

       public int Step { get; set; }

       public string Data { get; set; }

       public CaesarEncrypted(int step, string initData)

       {

           Step = step;

           Data = initData;

       }

       public CaesarEncrypted(string initData) : this(int.MaxValue, initData)

       {}

       public IEnumerator<char> GetEnumerator()

       {

           foreach (char c in Data)

               yield return c;

       }

       IEnumerator IEnumerable.GetEnumerator() => (IEnumerator<char>)GetEnumerator();

       public override string ToString() => Data;

       public static implicit operator string(CaesarEncrypted source) => source.ToString();

   }

}

0,0(0 оценок)
Полный доступ
Позволит учиться лучше и быстрее. Неограниченный доступ к базе и ответам от экспертов и ai-bota Оформи подписку
logo
Начни делиться знаниями
Вход Регистрация
Что ты хочешь узнать?
Спроси ai-бота