Guest User

Untitled

a guest
Dec 12th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.77 KB | None | 0 0
  1. /* In The Name of Allah */
  2. #include <algorithm>
  3. #include <bitset>
  4. #include <cassert>
  5. #include <cctype>
  6. #include <climits>
  7. #include <cmath>
  8. #include <complex>
  9. #include <cstdio>
  10. #include <cstdlib>
  11. #include <cstring>
  12. #include <ctime>
  13. #include <deque>
  14. #include <fstream>
  15. #include <functional>
  16. #include <iomanip>
  17. #include <iostream>
  18. #include <limits>
  19. #include <list>
  20. #include <map>
  21. #include <numeric>
  22. #include <queue>
  23. #include <set>
  24. #include <sstream>
  25. #include <stack>
  26. #include <string>
  27. #include <utility>
  28. #include <vector>
  29.  
  30. using namespace std;
  31.  
  32. /* Math */
  33. template < class T > inline T GCD(T a , T b){ if(a < 0) return GCD(-a , b) ; if(b < 0) return GCD(a , -b) ; return (b == 0) ? a : GCD(b , a % b) ; }
  34. template < class T > inline T LCM(T a , T b){ if(a < 0) return LCM(-a , b) ; if(b < 0) return LCM(a , -b) ; return a * (b / GCD(a , b)) ; }
  35. template < class T > inline bool isPrime(T n){ if(n < 2) return false ; for(T i = 2 ; i * i <= n ; i++) if(n % i == 0) return false ; return true ; }
  36. template < class T > vector <T> Divisor(T num){ vector <T> res ; res.clear() ; for(int i = 1 ; i <= num/2 ; i++) if(num % i == 0) res.push_back(i) ; return res ; }
  37. template < class T , class M > inline T POWER(T x , M y){/* (x ^ y) compute to 2^63 */ T temp = 1 ; if(y == 0) return 1 ; for(int i = 1 ; i <= y ; i++) temp *= x ; return temp ;}
  38.  
  39. /* Manipulation */
  40. template < class T , class M > bool Exist(T x , M element) { for(int i = 0 ; i < x.size() ; i++) if(x[i] == element) return true ; return false ; }
  41. template < class T > vector <T> Unique(vector <T> v){ T temp ; vector <T> res ; res.clear() ; for(int i = 0 ; i < v.size() ; i++){temp = v[i] ; if(Exist(res,temp) == false) res.push_back(temp) ; } return res ; }
  42. template < class T > vector <T> Parse(T temp){ vector <T> ans ; ans.clear() ; T s ; istringstream is(temp) ; while(is >> s){ ans.push_back(s) ; } return ans ; }
  43. template < class T > string toString(T x) {stringstream s ; s << x; return s.str() ; }
  44. template < class T > long long toInt(T x) {istringstream is(x) ; long long num ; is >> num ; return num ; }
  45.  
  46. template< class T > inline void checkMin(T &a , T b){ if(b < a) a = b ; }
  47. template< class T > inline void checkMax(T &a , T b){ if(b > a) a = b ; }
  48.  
  49. bool isLowerCase(char c){ return (c >= 'a' && c <= 'z') ; }
  50. bool isUpperCase(char c){ return (c >= 'A' && c <= 'Z') ; }
  51. char toLowerCase(char c){ return (isUpperCase(c) ? (c + 32) : c) ; }
  52. char toUpperCase(char c){ return (isLowerCase(c) ? (c - 32) : c) ; }
  53. bool isLetter ( char c ){ return (isUpperCase(c)) || (isLowerCase(c)) ; }
  54. bool isDigit ( char c ){ return (c >= '0' && c <= '9') ; }
  55.  
  56. /* Debug */
  57. template < class T > void print(T ans){ for(unsigned int i = 0 ; i < ans.size() ; i++ ) cout << ans[i] << " " ; cout << endl ; }
  58. template < class T > void print2(T ans){ cout << ans ; cout << endl ; }
  59.  
  60. typedef long long LL ;
  61. #define ALL(a) (a).begin(),(a).end()
  62. #define SZ(v) ((int)(v).size())
  63. #define Clear(x,with) memset(x , with , sizeof(x))
  64. #define FOR(i,start,end) for(int i = start ; i < end ; i++)
  65. #define REP(i,start,end) for(int i = start ; i >= end ; i--)
  66. #define FOREACH(it,x) for(it=(x.begin()) ; it != (x).end() ; it++)
  67. #define MOD 1000007
  68. //#define ROOM
  69.  
  70. int main()// Problem N - Find The Multiple
  71. {
  72. #ifdef ROOM
  73. //time_t et_0 = clock();
  74. freopen ("input.in","r",stdin) ;
  75. //ifstream cin("input.in") ;
  76. #endif
  77.  
  78. int n ;
  79. while(cin >> n && n != 0){// (I/O)
  80. string s ;
  81. while(n){
  82. s += ((n % 2) + '0') ;
  83. n /= 2 ;
  84. }
  85. reverse(ALL(s)) ;
  86. cout << s << s << endl ;
  87. }// end of (I/O)
  88.  
  89. #ifdef ROOM
  90. //time_t et_1 = clock();
  91. //fprintf(stderr, "Execution time = %0.3lf s\n", (double)(et_1 - et_0) / CLOCKS_PER_SEC);
  92. #endif
  93. return 0 ;
  94. }
Add Comment
Please, Sign In to add comment