1,2,3 feladat megoldasa

This commit is contained in:
kaoplo 2022-11-22 18:59:11 +01:00
parent bad3b165a5
commit 393ee2ad1d
6 changed files with 108 additions and 0 deletions

28
.vscode/tasks.json vendored Normal file
View file

@ -0,0 +1,28 @@
{
"tasks": [
{
"type": "cppbuild",
"label": "C/C++: g++ build active file",
"command": "/usr/bin/g++",
"args": [
"-fdiagnostics-color=always",
"-g",
"${file}",
"-o",
"${fileDirname}/${fileBasenameNoExtension}"
],
"options": {
"cwd": "${fileDirname}"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
},
"detail": "Task generated by Debugger."
}
],
"version": "2.0.0"
}

BIN
hf2/hf4/3 Executable file

Binary file not shown.

BIN
hf2/hf6/1 Executable file

Binary file not shown.

47
hf2/hf6/1.cpp Normal file
View file

@ -0,0 +1,47 @@
#include <bits/stdc++.h>
#include <iostream>
using namespace std;
int convert(string a) {
int out = 0;
int counter = 1;
//cout<<a<<endl;
for (int i = a.size() - 1; i > 0; i--) {
if(a[i] == '1' ) {
out += counter;
//cout<<"found one at "<< a[i] ;
}
//cout<< " current index "<< i <<" at character "<<a[i]<< " counter " << counter<<" current output " << out<<endl;
counter *= 2;
}
return out;
}
string convertToBase(int n, int base) {
string out;
return out;
}
int returnVecMax(vector<int> a) {
int out = a[0];
for (int i =1; i < a.size(); i++) {
if (a[i] > out) {
out = a[i];
}
}
return out;
}
int main() {
vector<int> test;
test.push_back(2);
test.push_back(6);
test.push_back(-7);
test.push_back(1);
test.push_back(0);
test.push_back(1);
test.push_back(4);
cout<<returnVecMax(test)<<endl<<convert("0101101");
}

BIN
hf2/hf6/3 Executable file

Binary file not shown.

33
hf2/hf6/3.cpp Normal file
View file

@ -0,0 +1,33 @@
#include <bits/stdc++.h>
#include <iostream>
using namespace std;
int returnVecMax(vector<int> a) {
int max = a[0];
int index = 0;
for (int i =1; i < a.size(); i++) {
if (a[i] > max) {
max = a[i];
index = i;
}
}
return index;
}
int main () {
int o, n, m, t, h;
cin >> o >> n >> m >> t >> h; //orak szama, tantargyak szama, egy sorszama, egy nap sorszama
int ts, tts, nap, ora; // tanar sorszam, tanitott tantargy sorszam, nap, ora
vector<int> tantargyElofordulas(n);
for (int i = 0; i < o; i++) {
cin >> ts >>tts>>nap>>ora;
tantargyElofordulas[ts] += 1;
}
// for (int i = 0; i < tantargyElofordulas.size(); i++) {
// cout<<tantargyElofordulas[i]<<endl;
// }
cout<<returnVecMax(tantargyElofordulas) + 1;
}