diff --git a/Problem_007/7_003.cpp b/Problem_007/7_003.cpp index d4ee4a6..955ad0e 100644 --- a/Problem_007/7_003.cpp +++ b/Problem_007/7_003.cpp @@ -5,60 +5,32 @@ const int MAX_SIZE = 100; const int MAXR = 100; const int MAXC = 100; -bool isFrobeniusMatrix(float matrix[MAX_SIZE][MAX_SIZE], int size) -{ - int countNonZeroColumns = 0; - - for (int i = 0; i < size; i++) - if (matrix[i][i] != 1) - return false; - for (int i = 0; i < size; i++) - for (int j = 0; j < size; j++) - if (i < j && matrix[i][j] != 0) - return false; +bool isMaTranDonVi(int matrix[MAX_SIZE][MAX_SIZE], int size); +void NhapMaTran(int matrix[MAX_SIZE][MAX_SIZE], int &size); +void NhapMaTran(int matrix[MAX_SIZE][MAX_SIZE], int &size) +{ + cin >> size; for (int i = 0; i < size; i++) { - int k = 0; for (int j = 0; j < size; j++) { - if (j > i && matrix[j][i] != 0) - k++; + cin >> matrix[i][j]; } - if (k != 0) - countNonZeroColumns++; } - if (countNonZeroColumns > 1) - return false; - return true; } -void NhapMaTran(float matrix[MAX_SIZE][MAX_SIZE], int size) +bool isMaTranDonVi(int matrix[MAX_SIZE][MAX_SIZE], int size) { for (int i = 0; i < size; i++) { for (int j = 0; j < size; j++) { - cin >> matrix[i][j]; + if ((i == j && matrix[i][j] != 1) || (i != j && matrix[i][j] != 0)) + { + return false; + } } } -} - -int main() -{ - float a[MAXR][MAXC]; - int n; - cin >> n; - int m; - cin >> m; - NhapMaTran(a, n); - if (isFrobeniusMatrix(a, n)) - { - cout << "Yes"; - } - else - { - cout << "No"; - } - return 0; + return true; } \ No newline at end of file diff --git a/docs/UnworkedProject.md b/docs/UnworkedProject.md index eabd311..23411a1 100644 --- a/docs/UnworkedProject.md +++ b/docs/UnworkedProject.md @@ -1,8 +1,12 @@ ## UNWORKED PROJECTS -List các file chưa làm: + +### PROBLEM_006 1. [6_004](../Problem_006/6_004.cpp) 2. [6_007](../Problem_006/6_007.cpp) -3. [7_002](../Problem_007/7_002.cpp) -4. [7_007](../Problem_007/7_007.cpp) + +### PROBLEM_007 + +1. [7_002](../Problem_007/7_002.cpp) +2. [7_007](../Problem_007/7_007.cpp) diff --git a/docs/WorkedProject.md b/docs/WorkedProject.md index 9c30a72..a2d8869 100644 --- a/docs/WorkedProject.md +++ b/docs/WorkedProject.md @@ -1,20 +1,24 @@ ## WORKED PROJECTS -List các file đã làm: + +### PROBLEM_006 1. [6_001](../Problem_006/6_001.cpp) -1. [6_002](../Problem_006/6_002.cpp) -1. [6_003](../Problem_006/6_003.cpp) -1. [6_005](../Problem_006/6_005.cpp) -1. [6_006](../Problem_006/6_006.cpp) -1. [6_008](../Problem_006/6_008.cpp) -1. [6_009](../Problem_006/6_009.cpp) -1. [6_010](../Problem_006/6_010.cpp) +2. [6_002](../Problem_006/6_002.cpp) +3. [6_003](../Problem_006/6_003.cpp) +4. [6_005](../Problem_006/6_005.cpp) +5. [6_006](../Problem_006/6_006.cpp) +6. [6_008](../Problem_006/6_008.cpp) +7. [6_009](../Problem_006/6_009.cpp) +8. [6_010](../Problem_006/6_010.cpp) + +### PROBLEM_007 + 1. [7_001](../Problem_007/7_001.cpp) -1. [7_003](../Problem_007/7_003.cpp) -1. [7_004](../Problem_007/7_004.cpp) -1. [7_005](../Problem_007/7_005.cpp) -1. [7_006](../Problem_007/7_006.cpp) -1. [7_008](../Problem_007/7_008.cpp) -1. [7_009](../Problem_007/7_009.cpp) -1. [7_010](../Problem_007/7_010.cpp) +2. [7_003](../Problem_007/7_003.cpp) +3. [7_004](../Problem_007/7_004.cpp) +4. [7_005](../Problem_007/7_005.cpp) +5. [7_006](../Problem_007/7_006.cpp) +6. [7_008](../Problem_007/7_008.cpp) +7. [7_009](../Problem_007/7_009.cpp) +8. [7_010](../Problem_007/7_010.cpp)