Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Айгерим практикасы.docx
Скачиваний:
0
Добавлен:
01.07.2025
Размер:
206 Кб
Скачать
☆
    1. Құжаттарды архив қағазына толтыру

Сонымен қатар, бөлім қызметшісі институттың құжаттарының жоғалып, ретсіз қалуын болдырмау үшін құжаттарды архив қағазына толтырып, олардың тізімін жасауын тапсырды. Практиканың әр күнінде неше түрлі құжаттарды архив қағазына толтырып, тексердім.Сол уақыт аралығында толтырған документтер тізімі:

  • Институт оқытушыларының жеке құжаттары;

  • Факультеттің аванстық құжаттары;

  • 2015жылға тиесілі құжаттар;

  • 2016 жылға тиесілі құжаттар;

  • Факультет оқытушылардың өтемақылары туралы бұйрық пен оның нөмірі, шығарылған күні;

  • Гарантиялық талондар көрсетілген құжаттар;

  • Факультет оқытушыларының қызметтік демалыс бұйрықтары мен өтемақылары туралы құжаттары;

  • Шот фактуралар көрсетілген құжаттардың тізімі;

  • Сертификаттардың тізімі мен нөмірлері;

  • Баға ұсыныстарын сұрату тәсілімен мемлекеттік сатып алу қорытындыларын бекіту туралы шешімдердің құжаттарының нөмірлері мен уақыттары;

  • «Ғылым саласы бойынша әлемдік серіктестік» программасы бойынша факультеттің басқа шетелдік оқу орындарымен келісімшарт қағаздары;

  • Ғылыми зерттеу институтында оқытушылардың 2015 жылғы декреттік демалыс, өтемақы туралы бұйрықтары;

  • Әрбір жылдың мемлекеттік алуға тиісті тауарлардың жылдық жоспары көрсетілген құжаттары;

  • Ғылыми зерттеу институтында факультеттің басқа мекемелерге жазылған ұсыныстары немесе бізге арналған ұсыныстар көрсетілген документтері;

  • Сатып алу мен конверттерді ашу протоколы көрсетілген, сонымен қатар баға ұсынысы, коммерстік ұсынысы көрсетілген документтері;

  • Әрбір жылдың мемлекеттің алуға тиісті товарлардың жылдық жоспары көрсетілген құжаттары;

  • Оқытушылардың басқа қалаға іссапары туралы бұйрықтары, нөмері, шығарылған күні;

3.3 Есеп

1.Write an expression that checks for given point {x, y} if it is within the circle K[{0, 0}, R=5] and out of the rectangle [{-1, 1}, {5, 5}]. Clarification: for the rectangle the lower left and the upper right corners are given. Guidelines: Use the code from the previous task and add a check for the rectangle. A point is inside a rectangle with walls parallel to the axes, when in the same time it is right of the left wall, left of the right wall, down from the top wall and above the bottom wall.

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Threading.Tasks;

namespace PRACTICE

{

class Program

{

static void Main(string[] args)

{

Console.Write("Enter x: ");

int x = Convert.ToInt32(Console.ReadKey());

Console.Write("Enter y: ");

int y = Convert.ToInt32(Console.ReadKey());

bool isInsideCircle = (x * x + y * y <= 5) ? true : false;

bool isOutsideRectangle = (x < -1 && x > 5 && y < 1 && y > 5) ? true : false;

Console.WriteLine("The point O({0},{1}) is inside K((0,0),5)?: {2}", x, y, isInsideCircle);

Console.WriteLine("The point O({0},{1}) is outside rectangle ((-1, 1), (5, 5)?: {2}", x, y, isOutsideRectangle);

}

}

}

2.Write a program that takes as input a four-digit number in format abcd (e.g. 2011) and performs the following actions: -Calculates the sum of the digits (in our example 2+0+1+1 = 4). -Prints on the console the number in reversed order: dcba (in our example 1102). -Puts the last digit in the first position: dabc (in our example 1201). -Exchanges the second and the third digits: acbd (in our example 2101). Guidelines: To get the individual digits of the number you can divide by 10 and take the remainder of the division by 10 four times.

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Threading.Tasks;

namespace PRACTICE

{

class Program

{

static void Main(string[] args)

{

Console.Write("Enter number: ");

int number = Convert.ToInt32(Console.ReadLine());

int a = number / 1000;

int b = (number / 100) % 10;

int c = (number / 10) % 10;

int d = number % 10;

Console.WriteLine("1.Sum of digits = {0}", a + b + c + d);

Console.WriteLine("2.Digits backwards = {3}{2}{1}{0}", a, b, c, d);

Console.WriteLine("3.Last digit on first place = {3}{0}{1}{2}", a, b, c, d);

Console.WriteLine("4.Replace third and second digit = {0}{2}{1}{3}", a, b, c, d);

}

}

}

3. Write a program that reads a, b and c from the console and calculates: ax2+bx+c=0. Guidelines: Use the method for calculating quadratic equations. 

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Threading.Tasks;

namespace PRACTICE

{

class Program

{

static void Main(string[] args)

{

double d, x1, x2;

Console.Write("Enter A (A != 0): ");

double a = Int32.Parse(Console.ReadLine());

Console.Write("Enter B: ");

double b = Int32.Parse(Console.ReadLine());

Console.Write("Enter C: ");

double c = Int32.Parse(Console.ReadLine());

d = b * b - 4 * a * c;

if (d < 0) Console.WriteLine("D={0}, There are no real roots.", d);

else if (d == 0)

{

x1 = (-b / (2 * a));

Console.WriteLine("X={0}", x1);

}

else

{

x1 = (-b + Math.Sqrt(d)) / (2 * a);

x2 = (-b - Math.Sqrt(d)) / (2 * a);

Console.WriteLine("X1={0}, X2={1}", x1, x2);

}

}

}

}

4.  We are given 5 integer numbers. Write a program that finds those subsets whose sum is 0. Examples: - If we are given the numbers {3, -2, 1, 1, 8}, the sum of -2, 1 and 1 is 0. >- If we are given the numbers {3, 1, -7, 35, 22}, there are no subsets with sum 0. Guidelines: Use nested if statements or series of 31 comparisons, in order to check all the sums of the 31 subsets of the given numbers (without the empty one). Note that the problem in general (with N numbers) is complex and using loops will not be enough to solve it.

namespace PRACTICE

{

class Program

{

static void Main(string[] args)

{

Console.Write("Enter first number: ");

sbyte first = Convert.ToSByte(Console.ReadLine());

Console.Write("Enter second number: ");

sbyte second = Convert.ToSByte(Console.ReadLine());

Console.Write("Enter third number: ");

sbyte third = Convert.ToSByte(Console.ReadLine());

Console.Write("Enter fourth number: ");

sbyte fourth = Convert.ToSByte(Console.ReadLine());

Console.Write("Enter fifth number: ");

sbyte fifth = Convert.ToSByte(Console.ReadLine());

if(first + second == 0)

Console.WriteLine("{0}+ {1} = 0", first, second);

if (first + third == 0)

Console.WriteLine("{0}+ {1} = 0", first, third);

if (first + fourth == 0)

Console.WriteLine("{0}+ {1} = 0", first, fourth);

if (first + fifth == 0)

Console.WriteLine("{0}+ {1} = 0", first, fifth);

if (second + third == 0)

Console.WriteLine("{0}+ {1} = 0", second, third);

if (second + fourth == 0)

Console.WriteLine("{0}+ {1} = 0", second, fourth);

if (second + fifth == 0)

Console.WriteLine("{0}+ {1} = 0", second, fifth);

if (third + fourth == 0)

Console.WriteLine("{0}+ {1} = 0", third, fourth);

if (third + fifth == 0)

Console.WriteLine("{0}+ {1} = 0", third, fifth);

if (fourth + fifth == 0)

Console.WriteLine("{0}+ {1} = 0", fourth, fifth);

if (first + second + third == 0)

Console.WriteLine("{0}+ {1}+ {2} = 0", first, second, third);

if (first + second + fourth == 0)

Console.WriteLine("{0}+ {1}+ {2} = 0", first, second, fourth);

if (first + second + fifth == 0)

Console.WriteLine("{0}+ {1}+ {2} = 0", first, second, fifth);

if (first + third + fourth == 0)

Console.WriteLine("{0}+ {1}+ {2} = 0", first, third, fourth);

if (first + third + fifth == 0)

Console.WriteLine("{0}+ {1}+ {2} = 0", first, third, fifth);

if (second + third + fourth == 0)

Console.WriteLine("{0}+ {1}+ {2} = 0", second, third, fourth);

if (second + third + fifth == 0)

Console.WriteLine("{0}+ {1}+ {2} = 0", second, third, fifth);

if (third + fourth + fifth == 0)

Console.WriteLine("{0}+ {1}+ {2} = 0", third, fourth, fifth);

Console.ReadLine();

}

}

}

5. In combinatorics, the Catalan numbers are calculated by the following formula:  , for n ≥ 0. Write a program that calculates the n-th Catalan number by given n. Guidelines: Use the same concept of canceling the faction of simple factors, like you probably did in the previous problem.

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Threading.Tasks;

namespace PRACTICE

{

class Program

{

static void Main(string[] args)

{

Console.Write("Enter N: (N >=0 ) ");

int n = Int32.Parse(Console.ReadLine());

int fact2N = 2 * n, factNplus1 = n + 1;

for (int i = fact2N - 1; i > 0; i--) fact2N *= i;

for (int i = factNplus1 - 1; i > 0; i--) factNplus1 *= i;

for (int i = n - 1; i > 0; i--) n *= i;

Console.WriteLine("Result is {0}", fact2N / (factNplus1 * n));

}

}

}

6. Write a program that converts Roman digits to Arabic ones. Guidelines: Scan the digits of the Roman number from left to right and add them up to a sum, which is initialized with a 0. When processing each Roman digit, take it with a positive or negative sign, depending on the digit after it (whether it has a bigger or smaller decimal value).

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Threading.Tasks;

namespace RomanToArabic

{

class Program

{

static void Main(string[] args)

{

int result = 0;

Console.Write("Enter Roman number: ");

String s = Console.ReadLine();

string[] chars = s.Select(c => c.ToString()).ToArray();

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

{

if (chars[i] == "m" || chars[i] == "M") result += 1000;

if (chars[i] == "d" || chars[i] == "D") result += 500;

if (chars[i] == "c" || chars[i] == "C")

{

result += 100;

if (i < chars.Length - 1)

{

if (chars[i + 1] == "d" || chars[i + 1] == "D") result -= 200;

if (chars[i + 1] == "m" || chars[i + 1] == "M") result -= 200;

}

}

if (chars[i] == "l" || chars[i] == "L") result += 50;

if (chars[i] == "x" || chars[i] == "X")

{

result += 10;

if (i < chars.Length - 1)

{

if (chars[i + 1] == "l" || chars[i + 1] == "L") result -= 20;

if (chars[i + 1] == "c" || chars[i + 1] == "C") result -= 20;

}

}

if (chars[i] == "v" || chars[i] == "V") result += 5;

if (chars[i] == "i" || chars[i] == "I")

{

result++;

if (i < chars.Length - 1)

{

if (chars[i + 1] == "v" || chars[i + 1] == "V") result -= 2;

if (chars[i + 1] == "x" || chars[i + 1] == "X") result -= 2;

}

}

}

Console.WriteLine("Arabic number is " + result);

}

}

}

7. Write a method that finds the biggest element of an array. Use that method to implement sorting in descending order. Guidelines: First write a method that finds the biggest element in array and then modify it to find the biggest element in given range of the array, e.g. in the elements at indexes [3…10]. Finally find the biggest number in the range [1…n-1] and swap it with the first element, then find the biggest element in the range [2…n-1] and swap it with the second element of the array and so on. Think when the algorithm should finish.

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Threading.Tasks;

namespace PRACTICE

{

class Program

{

public static int GetMax(int[] array, int start, int end)

{

int maxNum = array[start];

for (int i = start + 1; i < end; i++)

{

if (array[i] > maxNum) maxNum = array[i];

}

return maxNum;

}

public static void Main(string[] args)

{

Console.Write("Enter array length: ");

int length = Int32.Parse(Console.ReadLine());

int[] arr = new int[length];

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

{

Console.Write("Enter {0} element: ", i);

arr[i] = Int32.Parse(Console.ReadLine());

}

Console.Write("\nEnter start index: ");

int startIndex = Int32.Parse(Console.ReadLine());

Console.Write("Enter end index: ");

int endIndex = Int32.Parse(Console.ReadLine());

Console.WriteLine("Biggest number in interval {0}-{1} is {2}.", startIndex, endIndex, GetMax(arr, startIndex, endIndex));

}

}

}

8. You are given an array of integers and a number N. Write a recursive program that finds all subsets of numbers in the array, which have a sum N. For example, if we have the array {2, 3, 1, -1} and N=4, we can obtain N=4 as a sum in the following two ways: 4=2+3-1;4=3+1. Guidelines: The problem is not very different from the task with finding all subsets among a given list of strings. Shall it work fast enough with 500 numbers? Pay attention that we have to print all subsets with sum N which can be really big amount if N is very big and proper numbers exist in the array. For this reason the task has no efficient solution

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Threading.Tasks;

namespace PRACTICE

{

class Program

{

public static bool isSubsetSum(int[] arr, int n, int sum)

{

bool[,] subset = new bool[sum + 1, n + 1];

for(int i = 0; i <= n; i++)

subset[0,i] = true;

for(int i = 1; i <= sum; i++)

subset[i,0] = false;

for(int i = 1; i <= sum; i++)

for(int j = 1; j <= n; j++)

{

subset[i,j] = subset[i, j-1];

if(i >= arr[j - 1])

subset[i,j] = subset[i,j] || subset[i - arr[j-1], j-1];

}

return subset[sum, n];

}

static void Main(string[] args)

{

Console.Write("Enter arr length: ");

int length = Int32.Parse(Console.ReadLine());

int[] arr = new int[length];

for (int i = 0; i < length; i++)

{

Console.Write("Enter {0} element: ", i + 1);

arr[i] = Int32.Parse(Console.ReadLine());

}

Console.Write("Enter sum: ");

int sum = Int32.Parse(Console.ReadLine());

if (isSubsetSum(arr, arr.Length, sum) == true)

Console.WriteLine("Found a subset with given sum");

else

Console.WriteLine("No subset with given sum");

Console.ReadLine();

}

}

}

9. Write a program that calculates N!*K!/(N-K)! for given N and K (1 < K < N). Guidelines: One solution is to calculate separately each factorial and at the end to perform the respective operations with the results. Think how you can optimize the calculations, in order to not calculate too many factorials! In fractions of factorials there are many possibilities to reduce the same factors in the numerator and denominator. These optimizations will not only reduce the calculations and increase the performance but will save you from overflows in some situations. You might need to use arrays num[0..N] and denum[0..n] to hold the factors in the numerator and in the denominator and to cancel the fraction.

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Threading.Tasks;

namespace PRACTICE

{

class Program

{

static void Main(string[] args)

{

Console.Write("Enter N: (1<K<N) ");

int n = Int32.Parse(Console.ReadLine());

Console.Write("Enter K: (1<K<N) ");

int k = Int32.Parse(Console.ReadLine());

int nMinusK = n - k;

for (int i = n - 1; i > 0; i--) n *= i;

for (int i = k - 1; i > 0; i--) k *= i;

for (int i = nMinusK - 1; i > 0; i--) nMinusK *= i;

Console.WriteLine("Result is {0}", n * k / nMinusK);

}

}

}

10. Write a program, which creates an array of 20 elements of type integer and initializes each of the elements with a value equals to the index of the element multiplied by 5. Print the elements to the console. Guidelines: Use an int[] array and a for loop.

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Threading.Tasks;

namespace PRACTICE

{

class Program

{

static void Main(string[] args)

{

int[] arr = new int[20];

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

{

arr[i] = i * 5;

Console.WriteLine(arr[i]);

}

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]