init commit

This commit is contained in:
2025-04-13 21:48:15 +03:00
commit 23255e9121
192 changed files with 12200 additions and 0 deletions
+14
View File
@@ -0,0 +1,14 @@
class Sum
{
private:
int a, b;
public:
int
get() const {
return a + b;
}
Sum(int a, int b) : a(a), b(b) {};
Sum(Sum sum, int b) : a(sum.get()), b(b) {};
};
+27
View File
@@ -0,0 +1,27 @@
#include <iostream>
class A {
private:
int x;
bool to_print;
public:
A() {
x = 0;
to_print = false;
}
A(const A& a) {
std::cin >> x;
int t;
std::cin >> t;
x += t;
to_print = true;
}
~A() {
if (to_print) {
std::cout << x << std::endl;
}
}
};
+36
View File
@@ -0,0 +1,36 @@
#include <iostream>
#include <string>
#include <cctype>
int main() {
int c;
c = getchar();
bool is_num = false;
while (c != EOF) {
if (c == '0' && !is_num) {
int old = c;
c = getchar();
if (!(c == EOF || !isdigit(c))) {
continue;
}
putchar(old);
} else if (isdigit(c)) {
is_num = true;
} else {
is_num = false;
}
putchar(c);
c = getchar();
}
if (c != '\n') {
putchar('\n');
}
return 0;
}
+33
View File
@@ -0,0 +1,33 @@
#include <iostream>
int main() {
int x1_1, y1_1, x1_2, y1_2;
int x2_1, y2_1, x2_2, y2_2;
std::cin >> x1_1 >> y1_1 >> x1_2 >> y1_2;
std::cin >> x2_1 >> y2_1 >> x2_2 >> y2_2;
double k1, k2;
k1 = static_cast<double>(y1_2 - y1_1) / (x1_2 - x1_1);
k2 = static_cast<double>(y2_2 - y2_1) / (x2_2 - x2_1);
if (k1 == k2) {
if (y1_1 - k1 * x1_1 == y2_1 - k2 * x2_1) {
std::cout << 2 << std::endl;
} else {
std::cout << 0 << std::endl;
}
return 0;
}
double b1 = y1_1 - k1 * x1_1;
double b2 = y2_1 - k2 * x2_1;
double x_intersect = (b2 - b1) / (k1 - k2);
double y_intersect = k1 * x_intersect + b1;
std::cout.precision(6);
std::cout << std::fixed << x_intersect << " " << y_intersect << std::endl;
return 0;
}
+19
View File
@@ -0,0 +1,19 @@
#include <iostream>
#include <iomanip>
#include <cmath>
int main() {
double tmp, arip = 0, squar = 0;
int n = 0;
while (std::cin >> tmp) {
++n;
arip += (tmp - arip) / n;
squar += (tmp * tmp - squar) / n;
}
std::cout << std::setprecision(10);
std::cout << arip << std::endl << std::sqrt(squar - arip * arip) << std::endl;
return 0;
}