felig kesz
This commit is contained in:
parent
393ee2ad1d
commit
94327119bb
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -32,3 +32,5 @@
|
|||
*.out
|
||||
*.app
|
||||
|
||||
/.vscode
|
||||
|
||||
|
|
20
.vscode/tasks.json
vendored
20
.vscode/tasks.json
vendored
|
@ -22,6 +22,26 @@
|
|||
"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"
|
||||
|
|
|
@ -7,19 +7,30 @@ int convert(string a) {
|
|||
int counter = 1;
|
||||
|
||||
//cout<<a<<endl;
|
||||
for (int i = a.size() - 1; i > 0; i--) {
|
||||
if(a[i] == '1' ) {
|
||||
for (int i = a.size() - 1; i >= 0; i--) {
|
||||
if (a[i] == '1') {
|
||||
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 *= 2;
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -43,5 +54,10 @@ int main() {
|
|||
test.push_back(0);
|
||||
test.push_back(1);
|
||||
test.push_back(4);
|
||||
cout<<returnVecMax(test)<<endl<<convert("0101101");
|
||||
cout<<returnVecMax(test)<<endl<<convert("101101101")<<endl;
|
||||
|
||||
cout<<convertToBase(73,5)<<endl;
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -22,7 +22,8 @@ int main () {
|
|||
vector<int> tantargyElofordulas(n);
|
||||
|
||||
for (int i = 0; i < o; i++) {
|
||||
cin >> ts >>tts>>nap>>ora;
|
||||
cin >> ts >>tts>>nap>>ora;
|
||||
ts;
|
||||
tantargyElofordulas[ts] += 1;
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue