Skip to content

Commit

Permalink
fix whitespaces
Browse files Browse the repository at this point in the history
  • Loading branch information
maximp committed Jan 25, 2024
1 parent ed1eea1 commit 4d8afa3
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 28 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
a-stones-jewelry
b-sequence-ones
c-remove-doubles
d-gen-parenthesis
e-anagramm
g-trip
19 changes: 19 additions & 0 deletions a-stones-jewelry.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#include <iostream>
#include <string>

using namespace std;

int main(int argc, char** argv)
{
string j, s;
getline(cin, j);
getline(cin, s);

size_t num = 0;
for(char c : s)
{
if(j.find(c) != string::npos)
++num;
}
cout << num;
}
11 changes: 5 additions & 6 deletions b-sequence-ones.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ using namespace std;

int main(int argc, char** argv)
{
long int num = 0;
cin >> num;
long int num = 0;
cin >> num;

size_t maxbits = 0, bits = 0;
for(size_t n = 0; n < num; ++n)
size_t maxbits = 0, bits = 0;
for(size_t n = 0; n < num; ++n)
{
int elem = 0;
cin >> elem;
Expand All @@ -19,10 +19,9 @@ int main(int argc, char** argv)
} else if (elem == 0) {
bits = 0;
}

}

cout << maxbits;

return 0;
return 0;
}
14 changes: 7 additions & 7 deletions c-remove-doubles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,19 @@ int main(int argc, char** argv)
cin >> num;

if(num < 1)
return 0;
return 0;

int curr = 0;
cin >> curr;

for(size_t n = 1; n < num; ++n)
{
int elem = 0;
cin >> elem;
if(elem != curr)
{
int elem = 0;
cin >> elem;
if(elem != curr)
cout << curr << endl;
curr = elem;
}
curr = elem;
}

cout << curr << endl;

Expand Down
22 changes: 11 additions & 11 deletions d-gen-parenthesis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,20 @@ using namespace std;
void gen(int n, int counter_open, int counter_close, string ans)
{
if(counter_open + counter_close == 2 * n)
{
cout << ans << endl;
return;
{
cout << ans << endl;
return;
}
if(counter_open < n)
gen(n, counter_open + 1, counter_close, ans + '(');
if(counter_open > counter_close)
gen(n, counter_open, counter_close + 1, ans + ')');
if(counter_open < n)
gen(n, counter_open + 1, counter_close, ans + '(');
if(counter_open > counter_close)
gen(n, counter_open, counter_close + 1, ans + ')');
}

int main()
{
int n = 0;
cin >> n;
gen(n, 0, 0, "");
return 0;
int n = 0;
cin >> n;
gen(n, 0, 0, "");
return 0;
}
8 changes: 4 additions & 4 deletions e-anagramm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ using namespace std;

int main()
{
string s1, s2;
string s1, s2;
cin >> s1;
cin >> s2;
sort(s1.begin(), s1.end());
sort(s2.begin(), s2.end());
if(s1 == s2)
cout << "1";
cout << "1";
else
cout << "0";
return 0;
cout << "0";
return 0;
}

0 comments on commit 4d8afa3

Please sign in to comment.