nihonium
/
mipt_clang
Archived
1
0
Fork 0
remotes/private/master
nihonium 3 years ago
parent e7c8e83ce0
commit 23eb851b85

@ -0,0 +1,13 @@
#include <stdio.h>
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;
}

@ -0,0 +1,27 @@
#include <stdio.h>
#include <string.h>
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);
}