Advertisement
Guest User

Untitled

a guest
Nov 20th, 2017
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.58 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. // const int mod1 = 1000 * 1000;
  5. // const int mod2 = 201718;
  6.  
  7. int main(){
  8. int k;
  9. cin >> k;
  10. srand(k);
  11. int n;
  12.  
  13. if(k > 0 && k < 100){
  14. int mod1 = 10;
  15. int mod2 = 11;
  16.  
  17. n = rand()%mod1;
  18. n++;
  19. cout << n << "\n";
  20.  
  21. for(int i = 0; i < n; i++){
  22. cout << rand()%mod2 << " " ;
  23. }
  24.  
  25. return 0;
  26. }
  27. if( k > 99 && k < 200){
  28. int mod1 = 100;
  29. int mod2 = 50;
  30. int mod3 = 3;
  31. n = rand()%mod1 + 1;
  32. cout << n << "\n";
  33.  
  34. for(int i = 0; i < n; i++){
  35. int pom = rand()%mod2;
  36. cout << pom << " ";
  37. for(int j = 0; j < pom%3; j++){
  38. i++;
  39. if(i == n){
  40. return 0;
  41. }
  42. cout << pom << " " ;
  43. }
  44. }
  45.  
  46. return 0;
  47. }
  48. if(k > 199 && k < 300){
  49. int mod1 = 10000;
  50. int mod2 = 1000;
  51. int mod3 = 17;
  52. n = rand()%mod1 + 1;
  53. cout << n << "\n";
  54.  
  55. for(int i = 0; i < n; i++){
  56. int pom = rand()%mod2;
  57. cout << pom << " ";
  58. for(int j = 0; j < pom%3; j++){
  59. i++;
  60. if(i == n){
  61. return 0;
  62. }
  63. cout << pom << " " ;
  64. }
  65. }
  66. return 0;
  67. }
  68. if(k > 299 && k < 400){
  69. int mod1 = 1000*1000;
  70. int mod2 = 201718;
  71. int mod3 = 17;
  72. n = rand()%mod1 + 1;
  73. cout << n << "\n";
  74.  
  75. for(int i = 0; i < n; i++){
  76. int pom = rand()%mod2;
  77. cout << pom << " ";
  78. for(int j = 0; j < pom%3; j++){
  79. i++;
  80. if(i == n){
  81. return 0;
  82. }
  83. cout << pom << " " ;
  84. }
  85. }
  86. return 0;
  87. }
  88. if(k == 400){
  89. cout << "1\n0\n";
  90. return 0;
  91. }
  92. if(k == 401){
  93. n = 201718/3;
  94. cout << n << "\n";
  95. int licznik = 0;
  96. int pom = 0;
  97. while(licznik < n){
  98. cout << pom << " ";
  99. pom += 2;
  100. pom = pom % 201718;
  101. licznik++;
  102. }
  103. return 0;
  104. }
  105. n = rand()%(201718 / 3);
  106. int pom = 1;
  107. cout << n << "\n";
  108. int licznik = 0;
  109. while(licznik < n){
  110. cout << pom << " ";
  111. pom += (rand() % 3);
  112. pom = pom % 201718;
  113.  
  114. licznik++;
  115. }
  116.  
  117. return 0;
  118. }
  119.  
  120.  
  121. /* opis testów:
  122. W testach 1 - 399 jest duże prawdopodobieństwo wyłapania corner caseów
  123.  
  124. testy od 1 do 99 - testy małe, n do 10, a do 10, liczby losowe
  125.  
  126. testy od 100 do 199 - testy średnie, n do 100, a do 50, liczby losowe, powtarzające się
  127.  
  128. testy od 200 do 299 - testy większe, n do 10000, a do 1000, liczby losowe, powtarzające się
  129.  
  130. testy od 300 do 399 - maxtesty, n do 1 000 000, a do 201718, liczby losowe, powtarzające sie
  131.  
  132. testy od 400 do 405 - śmieszne rzeczy
  133. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement