This commit is contained in:
kaoplo 2022-11-24 20:45:26 +01:00
commit cad8519840
6 changed files with 147 additions and 0 deletions

2
.gitignore vendored
View file

@ -32,3 +32,5 @@
*.out *.out
*.app *.app
/.vscode

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

@ -0,0 +1,48 @@
{
"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."
},
{
"type": "cppbuild",
"label": "C/C++: cpp build active file",
"command": "/usr/bin/cpp",
"args": [
"-fdiagnostics-color=always",
"-g",
"${file}",
"-o",
"${fileDirname}/${fileBasenameNoExtension}"
],
"options": {
"cwd": "${fileDirname}"
},
"problemMatcher": [
"$gcc"
],
"group": "build",
"detail": "Task generated by Debugger."
}
],
"version": "2.0.0"
}

BIN
hf2/hf6/1 Executable file

Binary file not shown.

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

@ -0,0 +1,63 @@
#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 ";
}
counter = counter *2;
//cout<< "out: "<< out<< " counter: "<< counter<< " index: "<<i <<endl;
}
return out;
}
string convertToBase(int n, int base) {
string out;
char a = '0';
while (n > 0) {
a += n%base;
out = a + out;
n = n / base;
a = '0';
}
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("101101101")<<endl;
cout<<convertToBase(73,5)<<endl;
}

BIN
hf2/hf6/3 Executable file

Binary file not shown.

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

@ -0,0 +1,34 @@
#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;
ts;
tantargyElofordulas[ts] += 1;
}
// for (int i = 0; i < tantargyElofordulas.size(); i++) {
// cout<<tantargyElofordulas[i]<<endl;
// }
cout<<returnVecMax(tantargyElofordulas) + 1;
}