SHARE
TWEET

Untitled

a guest Jun 17th, 2019 60 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <vector>
  3.  
  4. using namespace std;
  5. typedef vector <int> v_int;
  6.  
  7. int main()
  8. {
  9.     int n,k=0;
  10.     v_int A;
  11.     cin >> n;
  12.    
  13.         for(int i=0; i<n; i++)
  14.         {
  15.             A.push_back((i+k)%10);
  16.             k=(i+k)/10;
  17.         }
  18.        
  19.         for(int i=n; i<2*n; i++)
  20.         {
  21.             A.push_back((2*n-i+k)%10);
  22.             k=(2*n-i+k)/10;
  23.         }
  24.         for(int i=A.size()-1; i>0; i--)
  25.             cout << A[i];
  26. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top