Advertisement
Caneq

lb3.6.2

Dec 12th, 2018
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.49 KB | None | 0 0
  1. #include "pch.h"
  2. #include <iostream>
  3. using namespace std;
  4.  
  5. int main(){
  6.     const int MAX = 200;
  7.     short arr[MAX] = { 3 };
  8.     for (int i = 1; i < 200; i++)
  9.     {
  10.         for (int j = 0; j < MAX; j++)
  11.         {
  12.             arr[j] *= 3;
  13.         }
  14.         for (int j = 0; j < MAX; j++)
  15.         {
  16.             if (arr[j] >= 10)
  17.             {
  18.                 arr[j + 1] += arr[j] / 10;
  19.                 arr[j] = arr[j] % 10;
  20.             }
  21.         }
  22.     }
  23.     for (int i = MAX - 1; i >= 0; i--) {
  24.         if (arr[i]) {
  25.             for (int j = i; j >= 0; j--) {
  26.                 cout << arr[j];
  27.             }
  28.             break;
  29.         }
  30.     }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement