diff --git a/numbers/octal.c b/numbers/octal.c new file mode 100644 index 0000000..8351cbd --- /dev/null +++ b/numbers/octal.c @@ -0,0 +1,13 @@ +#include + +int main() { + FILE *input = fopen("input.txt","r"); + unsigned long long int nya; + fscanf(input, "%lld\n", &nya); + fclose(input); + FILE *output = fopen("output.txt","w"); + fprintf(output, "%llo", nya); + fclose(output); + return 0; +} + diff --git a/numbers/triple.c b/numbers/triple.c new file mode 100644 index 0000000..608701d --- /dev/null +++ b/numbers/triple.c @@ -0,0 +1,27 @@ +#include +#include + +int pow_(int x, int y) { + if (!y) { + return 1; + } + int res = x; + for (int i = 1; i <= y-1; ++i) { + res = res*x; + } + return res; +} +int main() { + char nya[10000]; + int res = 0; + scanf("%s", nya); + + int len = strlen(nya); + for (int i = len-1; i >= 0; --i) { + res += (nya[i] - '0') * pow_(3, len-i-1); + } + printf("%d\n", res); + +} + +