felig kesz

This commit is contained in:
kaoplo 2022-11-24 20:42:58 +01:00
parent 393ee2ad1d
commit 94327119bb
6 changed files with 47 additions and 8 deletions

2
.gitignore vendored
View file

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

20
.vscode/tasks.json vendored
View file

@ -22,6 +22,26 @@
"isDefault": true "isDefault": true
}, },
"detail": "Task generated by Debugger." "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" "version": "2.0.0"

BIN
hf2/hf6/1

Binary file not shown.

View file

@ -7,19 +7,30 @@ int convert(string a) {
int counter = 1; int counter = 1;
//cout<<a<<endl; //cout<<a<<endl;
for (int i = a.size() - 1; i > 0; i--) { for (int i = a.size() - 1; i >= 0; i--) {
if(a[i] == '1' ) { if (a[i] == '1') {
out += counter; out += counter;
//cout<<"found one at "<< a[i] ; //cout<< "found one ";
} }
//cout<< " current index "<< i <<" at character "<<a[i]<< " counter " << counter<<" current output " << out<<endl; counter = counter *2;
counter *= 2; //cout<< "out: "<< out<< " counter: "<< counter<< " index: "<<i <<endl;
} }
return out; return out;
} }
string convertToBase(int n, int base) { string convertToBase(int n, int base) {
string out; string out;
char a = '0';
while (n > 0) {
a += n%base;
out = a + out;
n = n / base;
a = '0';
}
return out; return out;
} }
@ -43,5 +54,10 @@ int main() {
test.push_back(0); test.push_back(0);
test.push_back(1); test.push_back(1);
test.push_back(4); test.push_back(4);
cout<<returnVecMax(test)<<endl<<convert("0101101"); cout<<returnVecMax(test)<<endl<<convert("101101101")<<endl;
cout<<convertToBase(73,5)<<endl;
} }

BIN
hf2/hf6/3

Binary file not shown.

View file

@ -23,6 +23,7 @@ int main () {
for (int i = 0; i < o; i++) { for (int i = 0; i < o; i++) {
cin >> ts >>tts>>nap>>ora; cin >> ts >>tts>>nap>>ora;
ts;
tantargyElofordulas[ts] += 1; tantargyElofordulas[ts] += 1;
} }