diff --git a/zeta_cpp/completed/11005.cpp b/zeta_cpp/completed/11005.cpp new file mode 100644 index 0000000..9e15f36 --- /dev/null +++ b/zeta_cpp/completed/11005.cpp @@ -0,0 +1,41 @@ +#include +#include +#include + +using namespace std; + +char translate(int c) { + if (0 <= c && c <= 9) { + return 48 + c; + } else { + return 55 + c; + } +} + +vector calculate(int N, int B) { + vector S(0); + while (N >= B) { + S.push_back(N % B); + N /= B; + + } + S.push_back(N % B); + reverse(S.begin(), S.end()); + vector ST(0); + for(auto i: S) { + ST.push_back(translate(i)); + } + return ST; + +} + +int main() { + int N; + int B; + cin >> N >> B; + vector s = calculate(N, B); + for(auto i: s) { + cout << i; + } + return 0; +} \ No newline at end of file diff --git a/zeta_cpp/completed/2720.cpp b/zeta_cpp/completed/2720.cpp new file mode 100644 index 0000000..0c943fe --- /dev/null +++ b/zeta_cpp/completed/2720.cpp @@ -0,0 +1,29 @@ +#include + +using namespace std; + +void solve(int x, int c[], int cat[]) { + for (int i = 0; i < 4; i++) { + c[i] = (x / cat[i]); + x %= cat[i]; + } +} + +int main() { + int cat[4] = {25, 10, 5, 1}; + + int N; + + cin >> N; + for (int i = 0; i < N; i++) { + int x; + int coins[4]; + cin >> x; + solve(x, coins, cat); + for (int j = 0; j < 4; j++) { + cout << coins[j] << " "; + } + cout << endl; + } + return 0; +} \ No newline at end of file diff --git a/zeta_cpp/completed/2745.cpp b/zeta_cpp/completed/2745.cpp new file mode 100644 index 0000000..4ce7016 --- /dev/null +++ b/zeta_cpp/completed/2745.cpp @@ -0,0 +1,30 @@ +#include +#include + +using namespace std; + +int translate(char c) { + if (48 <= c && c <= 57) { + return c - 48; + } else { + return c - 55; + } +} + +int calculate(string s, int n) { + int l = s.length(); + int r = 0; + for (int i = 0; i < l; i++) { + r += translate(s[i]) * pow(n, l - i - 1); + } + return r; +} + + +int main() { + string s; + int n; + cin >> s >> n; + cout << calculate(s, n); + return 0; +} \ No newline at end of file diff --git a/zeta_cpp/completed/2903.cpp b/zeta_cpp/completed/2903.cpp new file mode 100644 index 0000000..92f15bd --- /dev/null +++ b/zeta_cpp/completed/2903.cpp @@ -0,0 +1,9 @@ +#include +#include + +int main() { + int n; + std::cin >> n; + std::cout << (int) pow(((1 << n) + 1), 2); + return 0; +} \ No newline at end of file diff --git a/zeta_cpp/run.sh b/zeta_cpp/run.sh new file mode 100644 index 0000000..504e76f --- /dev/null +++ b/zeta_cpp/run.sh @@ -0,0 +1,4 @@ +#!/bin/bash +if [ -z "$*" ]; then echo "No args"; exit 0; fi +g++ -std=c++17 $1 +./a.out < stdin.txt