Sinh Test

  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. long long Rand(long long l, long long h)
  4. {
  5. return l + ((long long)rand() * (RAND_MAX + 1) * (RAND_MAX + 1) * (RAND_MAX + 1) +
  6. (long long)rand() * (RAND_MAX + 1) * (RAND_MAX + 1) +
  7. (long long)rand() * (RAND_MAX + 1) +
  8. rand()) % (h - l + 1);
  9. }
  10. void write(string t){
  11. ofstream fileOutput(t);
  12. if(fileOutput.fail()){
  13. cout<<"Cannot open file at "<<t<<'\n';
  14. }
  15. fileOutput<<Rand(1,1000)<<'\n';
  16. }
  17. int main(){
  18. srand(time(NULL));
  19. int i;
  20. string s="";
  21. for(i=0;i<100;i++){
  22. s="C:/New folder/aka/"+to_string(i+1)+".inp";
  23. write(s);
  24. }
  25. return 0;
  26. }

Nhận xét

Bài đăng phổ biến từ blog này

Sinh Test trong Python va code AC

Cách tính a*b mod m , a^b mod m , a^(-1) mod m với m không phải là số nguyên tố (inversion có nghĩa khi (a,m)=1)

Python - Liệt kê tất các các chu trình trong đồ thị