SHARE
TWEET

Untitled

a guest Oct 19th, 2019 100 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. #define vi vector<int>
  6. #define ll long long
  7. #define pb push_back
  8. #define mp make_pair
  9. #define ii pair<int,int>
  10.  
  11. vector<long long> sequns()
  12. {
  13.     vector<long long> uns(15,1);
  14.    
  15.     for (int i = 1; i < 15; ++i)
  16.     {
  17.         uns[i] = uns[i-1]+pow(10,i);
  18.         //cout << "uns[i] = " << uns[i] << endl;
  19.     }
  20.     return uns;
  21. }
  22.  
  23. int main(){
  24.     long long n=0;
  25.     vector<long long> seq;
  26.  
  27.     cin >> n;
  28.     seq = sequns();
  29.  
  30.     int j = 1;
  31.     for (long long i = n; i < 1e12; i+=n)
  32.     {
  33.         if ((seq[j] % n) == 0)
  34.         {
  35.             break;
  36.         }else if(j < seq.size()-1){
  37.           j++;
  38.         }
  39.     }
  40.  
  41.     printf("%d\n",j+1);
  42.    
  43.    
  44.   return 0;
  45. }
  46.  
  47.  
  48. /*
  49. compilar
  50. g++ arquivo.cpp -std=c++11 -o executavel
  51. */
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