fork download
  1. #include <bits/stdc++.h>
  2. #define _nhatminh int main()
  3. #define ll long long
  4. #define str string
  5. #define fir first
  6. #define sec second
  7. #define ld long double
  8. #define pb push_back
  9. #define MOD 100000009
  10. #define freopen(name) if(fopen(name".INP","r")) {freopen (name".INP","r",stdin); freopen (name".OUT","w",stdout);}
  11. #define ALL(x) (x).begin(),(x).end()
  12. #define piint pair < int , int >
  13. #define piL pair < int , ll>
  14. #define pLL pair < ll , ll >
  15. #define TIME (1.0*clock()/CLOCKS_PER_SEC)
  16. using namespace std;
  17. const int Max_n=1e5;
  18. #define FOR( i , a , b ) for (int i = (a) , _b = (b) ; i <= _b ; i ++ )
  19. ll dp[Max_n+3][2];
  20. // ll a[Max_n+3] ;
  21. #define debug 0
  22. void solve(){
  23. // int n , k; cin >> n >> k ;
  24.  
  25. // FOR ( i , 1 , n ) cin >> a[i] ;
  26.  
  27. // FOR ( i , 0 , k )
  28. // FOR ( j , 0 , 1 )
  29. // dp[i][j] = -1e15;
  30. // dp[0][1] = 0 ;
  31. // ll res = 0 ;
  32. // FOR (i , 1 , n ){
  33. // FOR ( j , 0 , k ){
  34. // if (debug){
  35. // // cout << dp[j][1] << ' ' << dp[j][0] << ' ' << a[i] << " : " ;
  36. // }
  37. // if ( dp[j][0] != -1e15 ) dp[j][1] = max ( dp[j][0] + a[i] , dp[j][1]) ;
  38. // if ( j != 0 ) dp[j][0] = max ( dp[j][0] , dp[j-1][1] - a[i]) ;
  39. // res = max ( res , dp[j][1]) ;
  40. // if ( debug ){
  41. // cout << dp[j][1] << ' ' << dp[j][0] << ' ' << a[i] << '\n';
  42. // }
  43. // }
  44. // }
  45. // cout <<res ;
  46. }
  47. void problema(){
  48. // voi 00 lien tiep thi ta for a + 1lan cout << 0
  49. // tiep theo ta xet cout 01 b - 1 lan voi 1 dung dau
  50. int a , b , c ; cin >> a >> b >> c;
  51. if ( a + b + c == 0 ){
  52. cout << 0 << '\n' ;
  53. return ;
  54. }
  55. int c00 = 0 , c10 = 0 , c11 = 0 ;
  56. bool check = 0 ;
  57. if ( c == 0 ){
  58. if ( a != 0 ) FOR ( i , 1 , a+1 ) cout << 0 ;
  59. else {
  60. check = 1 ;
  61. }
  62. if (check){
  63. FOR ( i , 1 , b + 1) { cout << (check^1) ; check^=1 ; }
  64. }
  65. else {
  66. if ( b != 0 ) {cout << 1 ; check^=1; b--;}
  67. FOR ( i , 1 , b ) { cout << (check^1) ; check^=1 ; }
  68. }
  69. }
  70. else {
  71. if ( a != 0 ) FOR ( i , 1 , a+1 ) cout << 0 ;
  72. else {
  73. check = 1 ;
  74. }
  75. if (check){
  76. if ( b != 0 ) FOR ( i , 1 , b + 1) { cout << (check^1) ; check^=1 ; }
  77. }
  78. else {
  79. if ( b != 0 ) {cout << 1 ; check^=1; b--;}
  80. FOR ( i , 1 , b ) { cout << (check^1) ; check^=1 ; }
  81. }
  82. if (check == 0 || ( a == 0 && b== 0 )){
  83. // cerr <<"NOT\n";
  84. FOR ( i , 1 , c + 1) cout << 1;
  85. }
  86. else FOR ( i , 1 , c ) cout << 1;
  87. }
  88. cout << '\n';
  89. }
  90. _nhatminh{
  91. freopen("");
  92. ios_base::sync_with_stdio(0);
  93. cin.tie(0); cout.tie(0);
  94. int q=1;
  95. cin >> q;
  96. while (q--)
  97. problema() ; // solve();
  98. cerr << '\n' << "Time elapsed " << TIME << "s.\n";
  99. return (0);
  100. }
Success #stdin #stdout #stderr 0.01s 5288KB
stdin
Standard input is empty
stdout
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
stderr
Time elapsed 0.006483s.