#include <iostream>
#include <cstdlib> // Để sử dụng hàm rand() và srand()
#include <ctime> // Để sử dụng hàm time()
using namespace std;
int main() {
const int SIZE = 8;
int matrix[SIZE][SIZE];
// Khởi tạo seed cho hàm rand()
srand(static_cast<unsigned>(time(0)));
// Tạo ma trận 8x8 với số ngẫu nhiên từ 1 đến 100
for (int i = 0; i < SIZE; i++) {
for (int j = 0; j < SIZE; j++) {
matrix[i][j] = rand() % 100 + 1; // Số ngẫu nhiên từ 1 đến 100
}
}
// In ma trận ra màn hình
cout << "Ma tran 8x8:" << endl;
for (int i = 0; i < SIZE; i++) {
for (int j = 0; j < SIZE; j++) {
cout << matrix[i][j] << " ";
}
cout << endl;
}
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8Y3N0ZGxpYj4gLy8gxJDhu4Mgc+G7rSBk4bulbmcgaMOgbSByYW5kKCkgdsOgIHNyYW5kKCkKI2luY2x1ZGUgPGN0aW1lPiAgIC8vIMSQ4buDIHPhu60gZOG7pW5nIGjDoG0gdGltZSgpCgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKaW50IG1haW4oKSB7CiAgICBjb25zdCBpbnQgU0laRSA9IDg7CiAgICBpbnQgbWF0cml4W1NJWkVdW1NJWkVdOwoKICAgIC8vIEto4bufaSB04bqhbyBzZWVkIGNobyBow6BtIHJhbmQoKQogICAgc3JhbmQoc3RhdGljX2Nhc3Q8dW5zaWduZWQ+KHRpbWUoMCkpKTsKCiAgICAvLyBU4bqhbyBtYSB0cuG6rW4gOHg4IHbhu5tpIHPhu5Egbmfhuqt1IG5oacOqbiB04burIDEgxJHhur9uIDEwMAogICAgZm9yIChpbnQgaSA9IDA7IGkgPCBTSVpFOyBpKyspIHsKICAgICAgICBmb3IgKGludCBqID0gMDsgaiA8IFNJWkU7IGorKykgewogICAgICAgICAgICBtYXRyaXhbaV1bal0gPSByYW5kKCkgJSAxMDAgKyAxOyAvLyBT4buRIG5n4bqrdSBuaGnDqm4gdOG7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