forked from Segcolt/OBI-solutions
First attempt at doing some problems
This commit is contained in:
commit
e782e3cffc
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
build
|
||||||
93
phase3/2021/ogro.cpp
Normal file
93
phase3/2021/ogro.cpp
Normal file
@ -0,0 +1,93 @@
|
|||||||
|
#include <bits/stdc++.h>
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
#define V vector
|
||||||
|
|
||||||
|
#define rmin(a, b) a = min(a, b)
|
||||||
|
#define rmax(a, b) a = max(a, b)
|
||||||
|
|
||||||
|
#define rep(i, lim) for (size_t i = 0; i < (lim); i++)
|
||||||
|
#define nrep(i, s, lim) for (size_t i = s; i < (lim); i++)
|
||||||
|
|
||||||
|
#define repv(i, v) for (auto &i : (v))
|
||||||
|
#define fillv(v) for (auto &itr_ : (v)) { cin >> itr_; }
|
||||||
|
#define sortv(v) sort(v.begin(), v.end())
|
||||||
|
#define all(v) (v).begin(), (v).end()
|
||||||
|
|
||||||
|
using vi = vector<int>;
|
||||||
|
using vvi = vector<vi>;
|
||||||
|
using vvvi = vector<vvi>;
|
||||||
|
using vvvvi = vector<vvvi>;
|
||||||
|
|
||||||
|
using ll = long long;
|
||||||
|
|
||||||
|
using vl = vector<ll>;
|
||||||
|
using vvl = vector<vl>;
|
||||||
|
using vvvl = vector<vvl>;
|
||||||
|
using vvvvl = vector<vvvl>;
|
||||||
|
|
||||||
|
template<class v>
|
||||||
|
auto operator<<(ostream &os, const vector<v> &vec)->ostream& {
|
||||||
|
os << vec[0];
|
||||||
|
for (size_t i = 1; i < vec.size(); i++) {
|
||||||
|
os << ' ' << vec[i];
|
||||||
|
}
|
||||||
|
os << '\n';
|
||||||
|
return os;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class v>
|
||||||
|
auto operator>>(istream &is, vector<v> &vec)->istream& {
|
||||||
|
for (auto &i : vec) {
|
||||||
|
is >> i;
|
||||||
|
}
|
||||||
|
return is;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class v>
|
||||||
|
auto operator<<(ostream &os, const vector<vector<v>> &vec)->ostream& {
|
||||||
|
for (auto &i : vec) {
|
||||||
|
os << i[0];
|
||||||
|
for (size_t j = 1; j < i.size(); j++) {
|
||||||
|
os << ' ' << i[j];
|
||||||
|
}
|
||||||
|
os << '\n';
|
||||||
|
}
|
||||||
|
return os;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class v>
|
||||||
|
auto operator>>(istream &is, vector<vector<v>> &vec)->istream& {
|
||||||
|
for (auto &i : vec) {
|
||||||
|
for (auto &j : i) {
|
||||||
|
is >> j;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return is;
|
||||||
|
}
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
int n;
|
||||||
|
cin >> n;
|
||||||
|
|
||||||
|
if (n == 0) {
|
||||||
|
cout << "*\n";
|
||||||
|
} else {
|
||||||
|
for (size_t i = 0; i < n && i < 5; i++) {
|
||||||
|
cout << 'I';
|
||||||
|
}
|
||||||
|
cout << '\n';
|
||||||
|
n = max(0, n - 5);
|
||||||
|
}
|
||||||
|
if (n == 0) {
|
||||||
|
cout << "*\n";
|
||||||
|
} else {
|
||||||
|
for (size_t i = 0; i < n && i < 5; i++) {
|
||||||
|
cout << 'I';
|
||||||
|
}
|
||||||
|
cout << '\n';
|
||||||
|
n = min(0, n - 5);
|
||||||
|
}
|
||||||
|
}
|
||||||
129
phase3/2021/teclado.cpp
Normal file
129
phase3/2021/teclado.cpp
Normal file
@ -0,0 +1,129 @@
|
|||||||
|
#include <bits/stdc++.h>
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
#define V vector
|
||||||
|
|
||||||
|
#define rmin(a, b) a = min(a, b)
|
||||||
|
#define rmax(a, b) a = max(a, b)
|
||||||
|
|
||||||
|
#define rep(i, lim) for (size_t i = 0; i < (lim); i++)
|
||||||
|
#define nrep(i, s, lim) for (size_t i = s; i < (lim); i++)
|
||||||
|
|
||||||
|
#define repv(i, v) for (auto &i : (v))
|
||||||
|
#define fillv(v) for (auto &itr_ : (v)) { cin >> itr_; }
|
||||||
|
#define sortv(v) sort(v.begin(), v.end())
|
||||||
|
#define all(v) (v).begin(), (v).end()
|
||||||
|
|
||||||
|
using vi = vector<int>;
|
||||||
|
using vvi = vector<vi>;
|
||||||
|
using vvvi = vector<vvi>;
|
||||||
|
using vvvvi = vector<vvvi>;
|
||||||
|
|
||||||
|
using ll = long long;
|
||||||
|
|
||||||
|
using vl = vector<ll>;
|
||||||
|
using vvl = vector<vl>;
|
||||||
|
using vvvl = vector<vvl>;
|
||||||
|
using vvvvl = vector<vvvl>;
|
||||||
|
|
||||||
|
template<class v>
|
||||||
|
auto operator<<(ostream &os, const vector<v> &vec)->ostream& {
|
||||||
|
os << vec[0];
|
||||||
|
for (size_t i = 1; i < vec.size(); i++) {
|
||||||
|
os << ' ' << vec[i];
|
||||||
|
}
|
||||||
|
os << '\n';
|
||||||
|
return os;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class v>
|
||||||
|
auto operator>>(istream &is, vector<v> &vec)->istream& {
|
||||||
|
for (auto &i : vec) {
|
||||||
|
is >> i;
|
||||||
|
}
|
||||||
|
return is;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class v>
|
||||||
|
auto operator<<(ostream &os, const vector<vector<v>> &vec)->ostream& {
|
||||||
|
for (auto &i : vec) {
|
||||||
|
os << i[0];
|
||||||
|
for (size_t j = 1; j < i.size(); j++) {
|
||||||
|
os << ' ' << i[j];
|
||||||
|
}
|
||||||
|
os << '\n';
|
||||||
|
}
|
||||||
|
return os;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class v>
|
||||||
|
auto operator>>(istream &is, vector<vector<v>> &vec)->istream& {
|
||||||
|
for (auto &i : vec) {
|
||||||
|
for (auto &j : i) {
|
||||||
|
is >> j;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return is;
|
||||||
|
}
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
ios::sync_with_stdio(false);
|
||||||
|
cin.tie(nullptr);
|
||||||
|
|
||||||
|
int pip[256];
|
||||||
|
pip['a'] = '2';
|
||||||
|
pip['b'] = '2';
|
||||||
|
pip['c'] = '2';
|
||||||
|
pip['d'] = '3';
|
||||||
|
pip['e'] = '3';
|
||||||
|
pip['f'] = '3';
|
||||||
|
pip['g'] = '4';
|
||||||
|
pip['h'] = '4';
|
||||||
|
pip['i'] = '4';
|
||||||
|
pip['j'] = '5';
|
||||||
|
pip['k'] = '5';
|
||||||
|
pip['l'] = '5';
|
||||||
|
pip['m'] = '6';
|
||||||
|
pip['n'] = '6';
|
||||||
|
pip['o'] = '6';
|
||||||
|
pip['p'] = '7';
|
||||||
|
pip['q'] = '7';
|
||||||
|
pip['r'] = '7';
|
||||||
|
pip['s'] = '7';
|
||||||
|
pip['u'] = '8';
|
||||||
|
pip['t'] = '8';
|
||||||
|
pip['v'] = '8';
|
||||||
|
pip['w'] = '9';
|
||||||
|
pip['x'] = '9';
|
||||||
|
pip['y'] = '9';
|
||||||
|
pip['z'] = '9';
|
||||||
|
|
||||||
|
string a;
|
||||||
|
cin >> a;
|
||||||
|
|
||||||
|
int n;
|
||||||
|
cin >> n;
|
||||||
|
int count = 0;
|
||||||
|
while (n--) {
|
||||||
|
string b;
|
||||||
|
cin >> b;
|
||||||
|
if (b.size() != a.size()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool valid = true;
|
||||||
|
for (size_t i = 0; i < a.size() && valid; i++) {
|
||||||
|
if (pip[b[i]] != a[i]) {
|
||||||
|
valid = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (valid) {
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cout << count << '\n';
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user