First commit

This commit is contained in:
Buduf 2021-11-02 09:12:43 +01:00
parent dc37674855
commit 1a2f872ea9
8 changed files with 216 additions and 0 deletions

25
.vscode/launch.json vendored Normal file
View File

@ -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"
}]
}

25
.vscode/tasks.json vendored Normal file
View File

@ -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"
}

22
K1/13sportverseny1.cpp Normal file
View File

@ -0,0 +1,22 @@
#include <iostream>
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;
}

27
K1/14sportverseny2.cpp Normal file
View File

@ -0,0 +1,27 @@
#include <iostream>
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;
}

41
K1/1angolmertek.cpp Normal file
View File

@ -0,0 +1,41 @@
#include <iostream>
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;
}

24
K1/2bankbetet.cpp Normal file
View File

@ -0,0 +1,24 @@
#include <iostream>
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;
}
}

20
K1/3gyufa.cpp Normal file
View File

@ -0,0 +1,20 @@
#include <iostream>
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

32
K1/7lebegopontos.cpp Normal file
View File

@ -0,0 +1,32 @@
#include <iostream>
#include <math.h>
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;
}