Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (165.07 KB, 13 trang )
<span class="text_page_counter">Trang 1</span><div class="page_container" data-page="1">
#include <bits/stdc++.h>using namespace std;int a;
int main(){
freopen("SONGUYEN.INP","w", stdout); srand(time(0));
a= rand(); //Cho giá trị ngẫu nhiên từ 0 đến 32767 cout << a;
return 0;}
#include <bits/stdc++.h>const int N = 1e6+1;using namespace std;int a;
int main(){
freopen("SONGUYEN.INP","w", stdout); srand(time(0));
a= rand()*rand()% (N+1); cout << a;
return 0;}
#include <bits/stdc++.h>const int N = 1e9+1;using namespace std;int a;
int main(){
freopen("SONGUYEN.INP","w", stdout); srand(time(0));
a= rand()*rand()% (N+1);
</div><span class="text_page_counter">Trang 4</span><div class="page_container" data-page="4">cout << a; return 0;}
#include <bits/stdc++.h>const int N = 1e9;using namespace std;int a;
int main(){
freopen("SONGUYEN.INP","w", stdout); srand(time(0));
a= rand()*rand()% N +1; cout << a;
return 0;}
#include <bits/stdc++.h>using namespace std;int a;
int main(){
freopen("SONGUYEN.INP","w", stdout); srand(time(0));
int X = 10; int Y = 20;
a= X + rand()*rand()%(Y - X + 1); cout << a;
return 0;}
#include <bits/stdc++.h>const int N = 2e9;using namespace std;int a;
int main(){
freopen("SONGUYEN.INP","w", stdout); srand(time(0));
a= 1LL*rand()*rand()*rand()%(N+1); cout << a;
return 0;}
#include <bits/stdc++.h>const long long N = 1e18;using namespace std;
</div><span class="text_page_counter">Trang 5</span><div class="page_container" data-page="5">long long a;int main(){
freopen("SONGUYEN.INP","w", stdout); srand(time(0));
a= 1LL*rand()*rand()*rand()*rand()%(N+1); cout << a;
return 0;}
#include <bits/stdc++.h>const int N = 2e9;using namespace std;int a;
int main(){
freopen("SONGUYEN.INP","w", stdout); srand(time(0));
a= 1LL*rand()*rand()*rand()%(N+1) - 1LL*rand()*rand()*rand()%(N+1); cout << a;
return 0;}
#include <bits/stdc++.h>const long long N = 1e18;using namespace std;
long long a;int main(){
freopen("SONGUYEN.INP","w", stdout); srand(time(0));
a= 1LL*rand()*rand()*rand()*rand()%(N+1) - 1LL*rand()*rand()*rand()*rand()%(N+1);
cout << a; return 0;}
#include <bits/stdc++.h>const int N = 2e9;using namespace std;int a;
int n;int main(){
freopen("SONGUYEN.INP","w", stdout); srand(time(0));
</div><span class="text_page_counter">Trang 6</span><div class="page_container" data-page="6">n = 100;// thay đổi giá trị của n để sinh ra các test khác nhau cout << n << "\n";
for(int i = 1; i<= n; i++){
a = 1LL*rand()*rand()*rand()%(N+1)-1LL*rand()*rand()*rand()%(N+1); cout << a << " ";
}
return 0;}
#include <bits/stdc++.h>const int N = 100;using namespace std;int a;
int n;int main(){
freopen("SONGUYEN.INP","w", stdout); srand(time(0));
n = 100;// thay đổi giá trị của n để sinh ra các test khác nhau cout << n << "\n";
a = 0; // thay đổi giá trị bắt đầu nếu cần. for(int i = 1; i<= n; i++){
cout << a << " ";
a = a + rand()%N; // thay đổi giá trị N nếu cần }
return 0;}
#include <bits/stdc++.h>const int N = 100;using namespace std;int a;
int n;int main(){
freopen("SONGUYEN.INP","w", stdout); srand(time(0));
n = 100; // thay đổi giá trị của n để sinh ra các test khác nhau cout << n << "\n";
a = 0; // thay đổi giá trị bắt đầu nếu cần. for(int i = 1; i<= n; i++){
cout << a << " ";
a = a + rand()%N + 1; // thay đổi giá trị N nếu cần }
return 0;}
#include <bits/stdc++.h>const int N = 100;const int NN = 1e6;using namespace std;int a;
int n;
int b[NN+3];int main(){
freopen("SONGUYEN.INP","w", stdout); srand(time(0));
n = 100;// thay đổi giá trị của n để sinh ra các test khác nhau cout << n << "\n";
// sinh mảng b là mảng các số tăng
a = rand()%N; // thay đổi giá trị bắt đầu nếu cần. b[1] = a;
for(int i = 2; i<= n; i++){
a = a + rand()%N + 1; // thay đổi giá trị N nếu cần b[i] = a;
}
// đổi chỗ ngẫu nhiên 2 phần tử của mảng b
int t = 1000; // thay đổi giá tri t là số lần đổi chỗ for(int i = 1; i <= t; i++)
swap(b[rand()*rand()%n+1], b[rand()*rand()%n+1]); for (int i =1; i <= n; i++)
cout << b[i] << " "; return 0;
#include <bits/stdc++.h>const int N = 100;const int NN = 1e6;using namespace std;int a;
int n;
int b[NN+3];int main(){
freopen("SONGUYEN.INP","w", stdout); srand(time(0));
n = 100;// thay đổi giá trị của n để sinh ra các test khác nhau cout << n << "\n";
// sinh mảng b là mảng các số tăng
a = 2e9 - rand()%N; // thay đổi giá trị bắt đầu nếu cần. b[1] = a;
for(int i = 2; i<= n; i++){
a = a - (rand()%N + 1); // thay đổi giá trị N nếu cần b[i] = a;
}
// đổi chỗ ngẫu nhiên 2 phần tử của mảng b
int t = 1000; // thay đổi giá tri t là số lần đổi chỗ for(int i = 1; i <= t; i++)
swap(b[rand()*rand()%n+1], b[rand()*rand()%n+1]); for (int i =1; i <= n; i++)
cout << b[i] << " "; return 0;
}
</div><span class="text_page_counter">Trang 8</span><div class="page_container" data-page="8">#include <bits/stdc++.h>using namespace std;int n;
char ch;int main(){
freopen("XAU.INP","w", stdout); srand(time(0));
n = 100;// thay đổi giá trị của n để sinh ra các test khác nhau
cout << n << "\n"; // Nếu đề bài không yêu cầu in n thì ta bỏ dịng này for (int i = 1; i <= n; i ++){
ch = 97+ rand()%26; cout << ch;
}
return 0;}
#include <bits/stdc++.h>using namespace std;int n;
int main(){
freopen("XAU.INP","w", stdout); srand(time(0));
n = 100;// thay đổi giá trị của n để sinh ra các test khác nhau
cout << n << "\n"; // Nếu đề bài không yêu cầu in n thì ta bỏ dịng này for (int i = 1; i <= n; i ++)
cout << char(97+ rand()%26); return 0;
#include <bits/stdc++.h>using namespace std;int n;
int main(){
freopen("XAU.INP","w", stdout); srand(time(0));
n = 100; // Thay đổi giá trị của n để sinh ra các test khác nhau
cout << n << "\n"; // Nếu đề bài khơng u cầu in n thì ta bỏ dịng này for (int i = 1; i <= n; i ++)
cout << char(65 + rand()%26); return 0;
#include <bits/stdc++.h>using namespace std;
</div><span class="text_page_counter">Trang 9</span><div class="page_container" data-page="9">int n, nn;
char s[300]; // khai báo thừaint main(){
freopen("XAU.INP","w", stdout); srand(time(0));
n = 100;// thay đổi giá trị của n để sinh ra các test khác nhau
cout << n << "\n"; // Nếu đề bài khơng u cầu in n thì ta bỏ dòng này nn = 0;
for (char ch = 'a'; ch <= 'z'; ch++){ nn++;
s[nn] = ch; }
for (char ch = 'A'; ch <= 'Z'; ch++){ nn++;
s[nn] = ch; }
// nn = 52;
for (int i = 1; i <= n; i++ ) cout << s[rand()%nn + 1]; return 0;
#include <bits/stdc++.h>using namespace std;int n, nn;
char s[300]; // khai báo thừaint main(){
freopen("XAU.INP","w", stdout); srand(time(0));
n = 100;// thay đổi giá trị của n để sinh ra các test khác nhau
cout << n << "\n"; // Nếu đề bài không yêu cầu in n thì ta bỏ dịng này nn = 0;
for(char ch = 'a'; ch <= 'z'; ch++){ nn++;
s[nn] = ch; }
for(char ch = 'A'; ch <= 'Z'; ch++){ nn++;
s[nn] = ch; }
for(char ch = '0'; ch <= '9'; ch++){ nn++;
s[nn] = ch; }
// ta tính ra được nn = 62; for (int i = 1; i <= n; i++ ) cout << s[rand()%nn + 1]; return 0;
#include <bits/stdc++.h>using namespace std;int n, nn;
char s[300]; // khai báo thừaint main(){
</div><span class="text_page_counter">Trang 10</span><div class="page_container" data-page="10">freopen("XAU.INP","w", stdout); srand(time(0));
n = 100;// thay đổi giá trị của n để sinh ra các test khác nhau
cout << n << "\n"; // Nếu đề bài khơng u cầu in n thì ta bỏ dịng này nn = 0;
for(char ch = 'a'; ch <= 'z'; ch++){ nn++;
s[nn] = ch; }
for(char ch = 'A'; ch <= 'Z'; ch++){ nn++;
s[nn] = ch; }
for(char ch = '0'; ch <= '9'; ch++){ nn++;
s[nn] = ch; }
// ta tính ra được nn = 62; nn++;
#include <bits/stdc++.h>using namespace std;int n, nn;
char s[300]; // khai báo thừaint main(){
freopen("XAU.INP","w", stdout); srand(time(0));
n = 100;// thay đổi giá trị của n để sinh ra các test khác nhau
cout << n << "\n"; // Nếu đề bài khơng u cầu in n thì ta bỏ dòng này nn = 0;
for(char ch = 'a'; ch <= 'z'; ch++){ nn++;
s[nn] = ch; }
for(char ch = 'A'; ch <= 'Z'; ch++){ nn++;
s[nn] = ch; }
for(char ch = '0'; ch <= '9'; ch++){ nn++;
s[nn] = ch; }
</div>