Skip to content
This repository has been archived by the owner on Feb 15, 2024. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
NTGNguyen committed Oct 25, 2023
2 parents d69e77e + 1334671 commit 6d72027
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 11 deletions.
33 changes: 33 additions & 0 deletions Problem_006/6_004.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,40 @@
#include <iostream>
using namespace std;
int nt(int);

int main()
{
int a[100];
int n;
cin >> n;

for (int i = 0; i < n; i++)
{
cin >> a[i];
}

int flag = 0;
for (int i = 0; i < n; i++)
{
if (nt(a[i]) == 1)
{
flag = 1;
cout << a[i] << " ";
}
}

if (flag == 0)
cout << 0;
return 0;
}

int nt(int n)
{
int dem = 0;
for (int i = 1; i <= n; i++)
if (n % i == 0)
dem++;
if (dem == 2)
return 1;
return 0;
}
23 changes: 22 additions & 1 deletion Problem_006/6_009.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,28 @@
#include <iostream>
using namespace std;
void XoaNhieuPhanTu(int[], int &, int, int);

int main()
{
int a[100];
int n;
cin >> n;
for (int i = 0; i < n; i++)
cin >> a[i];

int p, k;
cin >> p >> k;

XoaNhieuPhanTu(a, n, p, k);
for (int i = 0; i < n; i++)
cout << a[i] << " ";

return 0;
}
}

void XoaNhieuPhanTu(int a[], int &n, int p, int k)
{
for (int i = p; i < n - k; ++i)
a[i] = a[i + k];
n -= k;
}
2 changes: 1 addition & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
![GitHub repo size](https://img.shields.io/github/repo-size/NMLT-NTTMK-K18/7-200-wecode?style=for-the-badge&color=D8B4F8)
[![GitHub contributors](https://img.shields.io/github/contributors/NMLT-NTTMK-K18/7-200-wecode?style=for-the-badge&color=FBF0B2)](../../../graphs/contributors)

[![WorkedProject Badge](https://img.shields.io/badge/progress-10%20%2F%2020-82A0D8?style=for-the-badge)](./UnworkedProject.md)
[![WorkedProject Badge](https://img.shields.io/badge/progress-14%20%2F%2020-82A0D8?style=for-the-badge)](./UnworkedProject.md)

---

Expand Down
14 changes: 5 additions & 9 deletions docs/UnworkedProject.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,8 @@
List các file chưa làm:

1. [6_002](../Problem_006/6_002.cpp)
2. [6_004](../Problem_006/6_004.cpp)
3. [6_007](../Problem_006/6_007.cpp)
4. [6_009](../Problem_006/6_009.cpp)
5. [7_002](../Problem_007/7_002.cpp)
6. [7_003](../Problem_007/7_003.cpp)
7. [7_004](../Problem_007/7_004.cpp)
8. [7_007](../Problem_007/7_007.cpp)
9. [7_008](../Problem_007/7_008.cpp)
10. [7_009](../Problem_007/7_009.cpp)
2. [6_007](../Problem_006/6_007.cpp)
3. [7_002](../Problem_007/7_002.cpp)
4. [7_004](../Problem_007/7_004.cpp)
5. [7_007](../Problem_007/7_007.cpp)
6. [7_009](../Problem_007/7_009.cpp)

0 comments on commit 6d72027

Please sign in to comment.