Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- #include <string>
- #include <stdlib.h>
- #include <algorithm>
- #include <map>
- #include <Windows.h>
- using namespace std;
- Ряд
- //long double fact(int N)
- //{
- // if (N < 0)
- // return 0;
- // if (N == 0)
- // return 1;
- // else
- // return N * fact(N - 1);
- //}
- //int main() {
- // setlocale(0, "");
- // int n;
- // int sum = 0;
- // cout << "Введите число: " << endl;
- // cin >> n;
- // for (int p = 1; p = n; p += 1) {
- // for (int s = 1; s = n; s += 1) {
- // for (int i = n; i == 1; i -= 1) {
- // for (int k = 12; k = 10 + 2 * n; i += 2) {
- //
- // sum += fact(i) / (pow(sin(k), s));
- // cout << sum << endl;
- // return 0;
- // }
- //
- // }
- // }
- // }
- //
- //
- // system("pause");
- // return 0;
- //}
- Матрицы
- //int main() {
- // setlocale(0, "");
- // double max_sell, min_sell;
- // double all_sum = 0, money_sum = 0, comission_sum = 0;
- // double max_money = -1000, min_money = 1000, max_comission = -1000, min_comission = 1000;
- // double A[3][4] = { {5, 2, 0, 10}, {3, 5, 2, 5}, {20, 0, 0, 0} };
- // double B[4][2] = { {1.2, 0.5}, {2.8, 0.4}, {5, 1}, {2, 1.5} };
- // double C[3][2];
- //
- // for (int i = 0; i < 3; i++) {
- // for (int j = 0; j < 2; j++) {
- // C[i][j] = 0;
- // for (int k = 0; k < 4; k++) {
- // C[i][j] += A[i][k] * B[k][j];
- // }
- // }
- // }
- // for (int i = 0; i <= 2; i++) {
- // if (C[i][0] > max_money) {
- // max_money = C[i][0];
- // max_sell = i + 1;
- // }
- // if (C[i][0] < min_money) {
- // min_money = C[i][0];
- // min_sell = i + 1;
- // }
- // }
- // cout << "Больше всего денег получил продавец - " << max_sell << ", меньше всего денег получил продавец - " << min_sell << endl;
- //
- // for (int i = 0; i <= 2; i++) {
- // if (C[i][1] > max_comission) {
- // max_comission = C[i][1];
- // max_sell = i + 1;
- // }
- // if (C[i][0] < min_comission) {
- // min_comission = C[i][0];
- // min_sell = i + 1;
- // }
- // }
- // cout << "Наибольшие комиссионные получил продавец - " << max_sell << ", наименьшие комисионные получил продавец - " << min_sell << endl;
- //
- // for (int i = 0; i <= 2; i++) {
- // money_sum += C[i][0];
- // }
- // cout << "Общая сумма денег, вырученных за проданные товары: " << money_sum << endl;
- //
- // for (int i = 0; i <= 2; i++) {
- // comission_sum += C[i][1];
- // }
- // cout << "Сумма комиссионных всех продавцов: " << comission_sum << endl;
- //
- // all_sum = comission_sum + money_sum;
- // cout << "Сумма денег, прошедшая через руки продавцов: " << all_sum << endl;
- //
- // system("pause");
- // return 0;
- //}
- Синусоида
- //int main() {
- // HANDLE handle = GetStdHandle(STD_OUTPUT_HANDLE);
- // CONSOLE_SCREEN_BUFFER_INFO consoleInfo;
- // GetConsoleScreenBufferInfo(handle, &consoleInfo);
- // int height = consoleInfo.srWindow.Bottom - consoleInfo.srWindow.Top + 1;
- // int width = consoleInfo.srWindow.Right - consoleInfo.srWindow.Left + 1;
- //
- // auto GetX = [&](double x) {
- // return int(x / 7 * width);
- // };
- // auto GetY = [&](double y) {
- // return int((-y / 1 + 1) * (height / 2));
- // };
- //
- // _COORD c;
- // for (double i = 0; i < 7; i += 0.02)
- // {
- // c.X = GetX(i);
- // c.Y = GetY(sin(i));
- // SetConsoleCursorPosition(handle, c);
- // cout << '*';
- // }
- //
- // cin.get();
- // CloseHandle(handle);
- //
- // return 0;
- //}
- Шарики
- //bool perestanovka(int* urna, int n)
- //{
- // for (int i = 0; i < n; ++i)
- // {
- // if (urna[i] == i)
- // {
- // return true;
- // }
- // }
- // return false;
- //}
- //
- //int main()
- //
- //{ setlocale(0, "");
- // int sum = 0, n = 10, max = 3628800;
- // int urna[10] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
- //
- // for (int i = 0; i < max; ++i)
- // {
- // next_permutation(urna, urna + n);
- // if (perestanovka(urna, n))
- // sum++;
- // }
- // cout << "Общее количество комбинаций: " << sum << endl;
- //
- // system("pause");
- // return 0;
- //}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement