This commit is contained in:
kaoplo 2022-10-08 13:05:44 +02:00
parent cbf7bbb57b
commit 5d9ba2c10c
6 changed files with 194 additions and 0 deletions

6
.vscode/settings.json vendored Normal file
View file

@ -0,0 +1,6 @@
{
"files.associations": {
"iostream": "cpp",
"ostream": "cpp"
}
}

38
hf16/2.cpp Normal file
View file

@ -0,0 +1,38 @@
#include <bits/stdc++.h>
#include <iostream>
using namespace std;
bool tukorSzam(string a) {
//ez undorító de nincs jobb ötletem xd
if (a[0] == a[7]) {
if (a[1] == a[6]) {
if (a[2] == a[5]) {
if (a[3] == a[4]) {
return true;
}
return false;
}
return false;
}
return false;
}
return false;
}
int main() {
int n;
cin>>n;
vector<string> telefonszamok(n);
for (int i = 0; i < n; i++) {
cin >> telefonszamok[i];
}
cout<<endl;
vector<string> out;
for (int i = 0; i < telefonszamok.size(); i++) {
if (tukorSzam(telefonszamok[i])) {
cout<<telefonszamok[i]<<endl;
}
}
}

42
hf17/1.cpp Normal file
View file

@ -0,0 +1,42 @@
#include <bits/stdc++.h>
#include <iostream>
using namespace std;
int vectorAverage(vector<int> n){
int out;
int temp = 0;
for (int i = 0; i<n.size(); i++) {
temp = n[i] + temp;
}
out = temp / n.size();
return out;
}
int main() {
int n, m, temp, out;
temp = 0;
cin>>n>>m;
vector<vector<int>> nap(m, vector<int> (n));
vector<int> temp1(m);
for (int i = 0; i<n; i++) {
for (int j = 0; j<m; j++) {
cin >> nap[i][j];
}
}
for (int i = 0; i<n; i++) {
for (int j = 0; j<m; j++) {
temp1[j] = nap[i][j];
}
if (vectorAverage(temp1) > temp) {
out = i +1;
}
}
cout<<out;
}

25
hf2/hf3/1.cpp Normal file
View file

@ -0,0 +1,25 @@
#include <bits/stdc++.h>
#include <iostream>
using namespace std;
int main() {
int n, k, temp;
cin >> n >> k;
vector<int> gyorsabb;
for (int i = 0; i < n; i++) {
cin >> temp;
if (temp < k) {
gyorsabb.push_back(i+1);
}
}
cout<<gyorsabb.size()<<" ";
for (int i = 0; i < gyorsabb.size(); i++) {
cout<<gyorsabb[i]<<" ";
}
}

37
hf2/hf3/2.cpp Normal file
View file

@ -0,0 +1,37 @@
#include <bits/stdc++.h>
#include <iostream>
using namespace std;
int main() {
int streak = 0;
bool streake = false;
string input;
vector<char> magan(5);
vector<int> out;
magan = {'a', 'e', 'i', 'o', 'u'};
cin >> input;
for (int i = 0; i < input.size(); i++) {
if (input[i] != magan[0] && input[i] != magan[1] && input[i] != magan[2] && input[i] != magan[3] && input[i] != magan[4]) {
streak++;
streake = true;
// cout << "yes" << ' ' << streak << " "<< streake<< ' '<<input[i]<<endl;
} else if (streake) {
out.push_back(streak);
streake = false;
streak = 0;
// cout << "over"<< endl;
}
}
if (streake) {
out.push_back(streak);
}
for (int i = 0; i < out.size(); i++) {
cout<<out[i]<<" ";
}
}

46
hf2/hf3/3.cpp Normal file
View file

@ -0,0 +1,46 @@
#include <bits/stdc++.h>
#include <iostream>
using namespace std;
int main() {
int a,b,c,x,y;
int n;
cin >> n;
vector<string> out;
for (int i = 0; i < n; i++) {
cin >> a >> b >> c >> x >> y; // a: kutyakaja, b: macskakaja, c: uni, x: kutya, y: macska
for (int j = 0; j < a; j++) { //kutya
if (x>0) {
x--;
}
}
//cout<< x<<endl;
for (int j = 0; j < b; j++) { //macska
if (y>0) {
y--;
}
}
//cout<< y<<endl;
for (int j = 0; j < c; j++) { //uni
if (x>0) {
x--;
} else if (y>0) {
y--;
}
}
//cout<< x<< ' '<< y <<endl;
if (x == 0 && y == 0) {
out.push_back("YES");
//cout<<"ran yes";
} else {
out.push_back("NO");
//cout<<"ran no";
}
}
for (int i = 0; i < n; i++) {
cout<<out[i]<<endl;
}
}