diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..c5f9e03 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,25 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [{ + "name": "g++.exe - Build and debug active file", + "type": "cppdbg", + "request": "launch", + "program": "${fileDirname}\\build\\${fileBasenameNoExtension}.exe", + "args": [], + "stopAtEntry": false, + "cwd": "${fileDirname}", + "environment": [], + "externalConsole": false, + "MIMode": "gdb", + "miDebuggerPath": "C:\\msys64\\mingw64\\bin\\gdb.exe", + "setupCommands": [{ + "description": "Enable pretty-printing for gdb", + "text": "-enable-pretty-printing", + "ignoreFailures": true + }], + "preLaunchTask": "C/C++: g++.exe build active file" + }] +} \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..7a2a215 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,25 @@ +{ + "tasks": [{ + "type": "cppbuild", + "label": "C/C++: g++.exe build active file", + "command": "C:\\msys64\\mingw64\\bin\\g++.exe", + "args": [ + "-g", + "${file}", + "-o", + "${fileDirname}\\build\\${fileBasenameNoExtension}.exe" + ], + "options": { + "cwd": "${fileDirname}" + }, + "problemMatcher": [ + "$gcc" + ], + "group": { + "kind": "build", + "isDefault": true + }, + "detail": "Task generated by Debugger." + }], + "version": "2.0.0" +} \ No newline at end of file diff --git a/K1/13sportverseny1.cpp b/K1/13sportverseny1.cpp new file mode 100644 index 0000000..a9bc3dc --- /dev/null +++ b/K1/13sportverseny1.cpp @@ -0,0 +1,22 @@ +#include + +using namespace std; + +int main() { + int n, r, k, m; + cin >> n; + r = n / 6; + m = n % 6; + if (m <= r) { + r -= m; + k = m; + m = 0; + } + else { + r = 0; + k = n / 7; + m = n % 7; + } + cout << r << " " << k << " " << m << endl; + return 0; +} \ No newline at end of file diff --git a/K1/14sportverseny2.cpp b/K1/14sportverseny2.cpp new file mode 100644 index 0000000..2947bc2 --- /dev/null +++ b/K1/14sportverseny2.cpp @@ -0,0 +1,27 @@ +#include + +using namespace std; + +void solve(int n) { + int a, b, m; + a = n / 5; + m = n % 5; + if (m / 2 <= a) { + a -= m / 2; + b = m / 2; + m = m % 2; + } + if (n % 7 < m) { + a = 0; + b = n / 7; + m = n % 7; + } + cout << a << "*5 + " << b << "*7 + " << m << " = " << 5 * a + 7 * b + m << endl; +} + +int main() { + for (int i = 5; i <= 100; i++) { + solve(i); + } + return 0; +} \ No newline at end of file diff --git a/K1/1angolmertek.cpp b/K1/1angolmertek.cpp new file mode 100644 index 0000000..d8c8988 --- /dev/null +++ b/K1/1angolmertek.cpp @@ -0,0 +1,41 @@ +#include + +using namespace std; + +int main() { + const int e[4]{ 1760, 3, 12, 1 }; + int a[4], b[4], x[4], y[4], A = 0, B = 0, X, Y; + cin >> a[0] >> a[1] >> a[2] >> a[3] >> b[0] >> b[1] >> b[2] >> b[3]; + for (int i = 0; i < 4; ++i) { + int n = 1; + for (int j = i; j < 3; ++j) { + n *= e[j]; + } + A += n * a[i]; + B += n * b[i]; + } + X = A + B; + Y = A - B; + cerr << "A=" << A << " B=" << B << endl << "X=" << X << " Y=" << Y << endl; + bool l = false; + if (Y < 0) { + Y *= -1; + l = true; + } + for (int i = 0; i < 4; ++i) { + int n = 1; + for (int j = i; j < 4; ++j) { + n *= e[j]; + } + x[i] = X / n; + y[i] = Y / n; + X %= n; + Y %= n; + } + cout << x[0] << " " << x[1] << " " << x[2] << " " << x[3] << endl; + if (l) { + cout << "-"; + } + cout << y[0] << " " << y[1] << " " << y[2] << " " << y[3] << endl; + return 0; +} \ No newline at end of file diff --git a/K1/2bankbetet.cpp b/K1/2bankbetet.cpp new file mode 100644 index 0000000..9ca1924 --- /dev/null +++ b/K1/2bankbetet.cpp @@ -0,0 +1,24 @@ +#include + +using namespace std; + +int main() { + int x, s, p, h, y = 0; + cin >> x >> s >> p >> h; + + for (int i = 0; i < h; ++i) { + if (x >= 1000) { + x += (s + p) * (x / 100); + } + else { + x += s * (x / 100); + } + y += x % 100; + x -= x % 100; + if (y / 100 >= 1) { + y -= 100; + x += 100; + } + cout << x << " " << y << endl; + } +} \ No newline at end of file diff --git a/K1/3gyufa.cpp b/K1/3gyufa.cpp new file mode 100644 index 0000000..7ad6483 --- /dev/null +++ b/K1/3gyufa.cpp @@ -0,0 +1,20 @@ +#include + +using namespace std; + +int main() { + int N; + cin >> N; + double a = N / 3.0; + for (int i = 1; i < a; ++i) { + double b = N / 2; + for (int j = N / 2 - i; j < b; ++j) { + cout << i << " " << j << " " << N - i - j << endl; + } + } + return 0; +} + +// a < b + c +// b < a + c +// c < a + b \ No newline at end of file diff --git a/K1/7lebegopontos.cpp b/K1/7lebegopontos.cpp new file mode 100644 index 0000000..6334bbc --- /dev/null +++ b/K1/7lebegopontos.cpp @@ -0,0 +1,32 @@ +#include +#include + +using namespace std; + +void simplify(int x, int y) { + if (x == 0) { + y = 0; + } + else { + while (x % 10 == 0) { + x /= 10; + y += 1; + } + } + cout << x << " " << y << endl; +} + +int main() { + int a1, b1, a2, b2, x, y; + cin >> a1 >> b1 >> a2 >> b2; + y = min(b1, b2); + x = a1 * pow(10, b1 - y) + a2 * pow(10, b2 - y); + simplify(x, y); + y = min(b1, b2); + x = a1 * pow(10, b1 - y) - a2 * pow(10, b2 - y); + simplify(x, y); + y = b1 + b2; + x = a1 * a2; + simplify(x, y); + return 0; +} \ No newline at end of file