Advertisement
mb6ockatf

shit.c

Nov 17th, 2023 (edited)
825
0
180 days
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.38 KB | Source Code | 0 0
  1. /* https://inf-ege.sdamgia.ru/problem?id=38589
  2.  * BROKEN
  3.  */
  4. #pragma GCC diagnostic ignored "-Wpedantic"
  5. #include <stdio.h>
  6. #include <math.h>
  7. #include <string.h>
  8. __extension__ typedef __int128 int128;
  9. const unsigned long long int PRECISION = 10ULL;
  10. unsigned __int128 ipow(unsigned __int128 base, unsigned __int128 exp);
  11. unsigned __int128 ipow(unsigned __int128 base, unsigned __int128 exp)
  12. {
  13.     unsigned __int128 result = 1ULL;
  14.     while( exp )
  15.     {
  16.         if ( exp & 1 )
  17.         {
  18.             result *= (unsigned __int128)base;
  19.         }
  20.         exp >>= 1;
  21.         base *= base;
  22.     }
  23.     return result;
  24. }
  25. int main(void) {
  26.     unsigned __int128 number1, number2, number3, number4, number5, sum;
  27.     number1 = ipow(4ULL, 38ULL);
  28.     number2 = 2ULL * ipow(4ULL, 23ULL);
  29.     number3 = ipow(4ULL, 20ULL);
  30.     number4 = 3ULL * ipow(4ULL, 5ULL);
  31.     number5 = 2ULL * ipow(4ULL, 4ULL) + 1ULL;
  32.     sum = 3ULL * number1 + number2 + number3 + number4 + number5;
  33.     printf("%ll", value);
  34.     printf("%ll\n", sum);
  35.     unsigned char string[400] = "";
  36.     unsigned short int i = 0, count = 0;
  37.     while (sum) {
  38.         string[i] = (sum % 16) + '0';
  39.         sum /= 16ULL;
  40.         i++;
  41.     }
  42.     for (int j = 0; string[j] != '\0'; j++) {
  43.         if (string[j] == '0')
  44.             count++;
  45.     }
  46.     unsigned long long int part1, part2;
  47.     part2 = count % PRECISION;
  48.     part1 = count / PRECISION;
  49.     printf("%llu", part1);
  50.     printf("%llu", part2);
  51.     return 0;
  52. }
  53.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement