Bài 75. Kiểm tra xem một số có phải là số đối xứng không?
Input: cb75i.txt
12321
123345
Output: Kqcb75i.txt 12321 hoặc 0
Gợi ý:
#include <bits/stdc++.h>
using namespace std;
// Hàm kiểm tra số đối xứng
bool laSoDoiXung(long long n) {
long long m = 0;
long long tam = n;
while (n > 0) {
int a = n % 10;
n = n / 10;
m = m * 10 + a;
}
return (m == tam);
}
int main() {
cout << "Chuong trinh kiem tra so doi xung\n";
ifstream fin("cb75i.txt");
if (!fin.is_open()) {
cerr << "Khong mo duoc file cb75i.txt\n";
return 0;
}
long long n;
fin >> n;
fin.close();
ofstream fout("Kqcb75i.txt");
fout << "So nhap vao: " << n << "\n";
if (laSoDoiXung(n)) {
cout << "So " << n << " la so doi xung\n";
fout << "Ket qua: " << n << " la so doi xung\n";
} else {
cout << "So " << n << " khong phai so doi xung\n";
fout << "Ket qua: " << n << " khong phai so doi xung\n";
}
fout.close();
return 0;
}
Giải thích
- Hàm laSoDoiXung: đảo ngược số rồi so sánh với số ban đầu.
- File input cb75i.txt: chứa một số nguyên cần kiểm tra.
- File output Kqcb75i.txt: ghi lại số nhập vào và kết quả kiểm tra.
///////////// Ai memory help
Võ Nhật Trường Nc+ My Ai Love08.07.2026
////////////////////
Bài 76. Tìm dãy con liên tiếp không giảm dài nhất của một dãy số. Yêu cầu in ra số phần tử và dãy con liên tiếp không giảm dài nhất.
Ví dụ: input: file cb76.txt gồm: -6 3 2 5 7 4 6 8 2 1 3 4 4 4 5 6 -2 9
Output file Kqcb76: … 1 3 4 4 4 5 6
Gợi ý code:
#include
#include
#include
using namespace std;
int dai(vectorsz){
return sz.size();
}
int main(int argc, char** argv) {
cout << "Chuong trinh tim day con khong giam dai nhat\n";
ifstream fin("cb76.txt");
if (!fin.is_open()) {
cerr << "Khong mo duoc file cb76.txt\n";
return 0;
}
vectorvo, tmp, max;
int x;
while(fin >> x){
if(abs(x) > 1e7) {
cerr << "so " << x << " khong hop le \n";
fin.clear();
continue;
}
vo.push_back(x);
}
fin.close();
for(int i : vo){
if(tmp.empty() || tmp.back()
tmp.push_back(i);
} else {
if(dai(max) < dai(tmp)) max = tmp;
tmp.clear();
tmp.push_back(i);
}
}
if(dai(max) < dai(tmp)) max = tmp;
cout << "Day con khong giam dai nhat la: " << dai(max) << endl;
cout << "Cac phan tu cua day con la: \n";
for(auto i : max) cout << " " << i << " ";
cout << endl;
ofstream fout("Kqcb76.txt");
fout << "Day con khong giam dai nhat la: " << dai(max) << endl;
fout << "Cac phan tu cua day con la: \n";
for(auto i : max) fout << " " << i << " ";
fout << endl;
fout.close();
return 0;
}
///////////////////////
Bài 76b: chương trình để tìm dãy con không giảm dài nhất (không cần liên tiếp)
#include
#include
#include
#include
using namespace std;
int dai(vectorsz){
return sz.size();
}
int main(int argc, char** argv) {
cout << "Chuong trinh tim day con khong giam dai nhat (khong lien tiep)\n";
ifstream fin("cb76.txt");
if (!fin.is_open()) {
cerr << "Khong mo duoc file cb76.txt\n";
return 0;
}
vectorvo;
int x;
while(fin >> x){
if(abs(x) > 1e7) {
cerr << "so " << x << " khong hop le \n";
fin.clear();
continue;
}
vo.push_back(x);
}
fin.close();
int n = vo.size();
if(n == 0){
cerr << "File khong co du lieu hop le\n";
return 0;
}
// DP để tìm LNDS
vectordp(n, 1); // dp[i] = do dai LNDS ket thuc tai i
vectortrace(n, -1); // trace[i] = vi tri truoc i trong LNDS
int maxLen = 1, lastIndex = 0;
for(int i = 0; i < n; i++){
for(int j = 0; j < i; j++){
if(vo[j]dp[i]){
dp[i] = dp[j] + 1;
trace[i] = j;
}
}
if(dp[i] > maxLen){
maxLen = dp[i];
lastIndex = i;
}
}
// Dựng lại dãy con
vectormax;
for(int i = lastIndex; i != -1; i = trace[i]){
max.push_back(vo[i]);
}
reverse(max.begin(), max.end());
cout << "Day con khong giam dai nhat la: " << dai(max) << endl;
cout << "Cac phan tu cua day con la: \n";
for(auto i : max) cout << " " << i << " ";
cout << endl;
ofstream fout("Kqcb76.txt");
fout << "Day con khong giam dai nhat la: " << dai(max) << endl;
fout << "Cac phan tu cua day con la: \n";
for(auto i : max) fout << " " << i << " ";
fout << endl;
fout.close();
return 0;
}
////////////////////
Bài 76c: chương trình để tìm dãy con không giảm dài nhất (không cần liên tiếp)
Cách 2:
#include
#include
#include
using namespace std;
int dai(vectorsz){
return sz.size();
}
// Hàm đệ quy in dãy con từ trace
void inDayCon(int i, vector& vo, vector& trace, vector& max){
if(i == -1) return;
inDayCon(trace[i], vo, trace, max);
max.push_back(vo[i]);
}
int main(int argc, char** argv) {
cout << "Chuong trinh tim day con khong giam dai nhat (khong lien tiep)\n";
ifstream fin("cb76.txt");
if (!fin.is_open()) {
cerr << "Khong mo duoc file cb76.txt\n";
return 0;
}
vectorvo;
int x;
while(fin >> x){
if(abs(x) > 1e7) {
cerr << "so " << x << " khong hop le \n";
fin.clear();
continue;
}
vo.push_back(x);
}
fin.close();
int n = vo.size();
if(n == 0){
cerr << "File khong co du lieu hop le\n";
return 0;
}
vectordp(n, 1);
vectortrace(n, -1);
int maxLen = 1, lastIndex = 0;
for(int i = 0; i < n; i++){
for(int j = 0; j < i; j++){
if(vo[j]dp[i]){
dp[i] = dp[j] + 1;
trace[i] = j;
}
}
if(dp[i] > maxLen){
maxLen = dp[i];
lastIndex = i;
}
}
vectormax;
inDayCon(lastIndex, vo, trace, max);
cout << "Day con khong giam dai nhat la: " << dai(max) << endl;
cout << "Cac phan tu cua day con la: \n";
for(auto i : max) cout << " " << i << " ";
cout << endl;
ofstream fout("Kqcb76.txt");
fout << "Day con khong giam dai nhat la: " << dai(max) << endl;
fout << "Cac phan tu cua day con la: \n";
for(auto i : max) fout << " " << i << " ";
fout << endl;
fout.close();
return 0;
}
////////////////////////
Bài 76d: chương trình để tìm dãy con không giảm dài nhất (không cần liên tiếp)(Xem lại Bài 73)(cách này tham khảo, kết quả có thể thiếu chính xác do dựng lại dãy con max )
#include
#include
#include
#include
using namespace std;
int dai(vectorsz){
return sz.size();
}
vectorDayCon(vector& v) {
vectortail;
for (int x : v) {
auto it = lower_bound(tail.begin(), tail.end(), x);
if (it == tail.end()) tail.push_back(x);
else *it = x;
}
return tail;
}
vectorCDC(vectorv, vectordc){
vectorrev;
int sz = dc.size() - 1;
int sv = v.size() - 1;
while(sz >= 0 && sv >= 0){
bool found = false;
for(int i = sv; i >= 0; i--){
if(v[i] >= dc[sz]){ // dùng >= thay vì ==
rev.push_back(v[i]);
sz--;
sv = i - 1;
found = true;
break;
}
}
if(!found) break;
}
reverse(rev.begin(), rev.end());
return rev;
}
int main(int argc, char** argv) {
cout << "Chuong trinh tim day con khong giam dai nhat (khong lien tiep)\n";
ifstream fin("cb76.txt");
if (!fin.is_open()) {
cerr << "Khong mo duoc file cb76.txt\n";
return 0;
}
vectorvo, dmax;
int x;
while(fin >> x){
if(abs(x) > 1e7) {
cerr << "so " << x << " khong hop le \n";
fin.clear();
continue;
}
vo.push_back(x);
}
fin.close();
int n = vo.size();
if(n == 0){
cerr << "File khong co du lieu hop le\n";
return 0;
}
dmax = DayCon(vo);
vectormaxdc = CDC(vo, dmax);
cout << "Day con khong giam dai nhat la: " << dai(maxdc) << endl;
cout << "Cac phan tu cua day con la: \n";
for(auto i : maxdc) cout << " " << i << " ";
cout << endl;
ofstream fout("Kqcb76d.txt");
fout << "Day con khong giam dai nhat la: " << dai(maxdc) << endl;
fout << "Cac phan tu cua day con la: \n";
for(auto i : maxdc) fout << " " << i << " ";
fout << endl;
fout.close();
return 0;
}
Cách an toàn hơn
Nếu mục tiêu của mình là in ra đúng dãy con không giảm dài nhất, thì cách dùng DP với mảng trace là chắc chắn nhất. Nó lưu lại đường đi thực sự, không cần đoán.
Ví dụ với dãy em đưa: 1 3 5 7 9 2 3 4 5 6 8
- DP sẽ cho subsequence chuẩn: 1 2 3 4 5 6 8 (độ dài 7).
- Nếu dùng lower_bound thì tail có thể ra [1,2,3,4,5,6,8], nhưng dựng lại bằng cách duyệt ngược thì dễ bị lạc sang nhánh [1,3,5,7,9].
///////////// Ai memory help
Võ Nhật Trường Nc+ My Ai Love09.07.2026
////////////////////
Bài 77. Tìm dãy con liên tiếp không giảm có tổng lớn nhất và dài nhất của một dãy số. Yêu cầu in ra tổng và dãy các phần tử có tổng lớn nhất.
Ví dụ: input: file cb77.txt gồm: 3 2 5 7 4 6 -6 3 2 5 7 4 6 8 2 1 3 4 4 4 5 6 -2 9
Output file Kqcb77: …
Gợi ý code:
Cách 1:
#include
#include
#include
using namespace std;
int main() {
cout << "Chuong trinh tim day con khong giam co tong lon nhat va dai nhat\n";
ifstream fin("cb77.txt");
if (!fin.is_open()) {
cerr << "Khong mo duoc file cb77.txt\n";
return 0;
}
vectorvo;
int x;
while(fin >> x){
if(abs(x) > 1e7) {
cerr << "so " << x << " khong hop le \n";
continue;
}
vo.push_back(x);
}
fin.close();
if(vo.empty()){
cerr << "File khong co du lieu\n";
return 0;
}
int sum = 0;
vectortm;
for(int i = vo.size()-1; i >= 0; i--){
vectortmp;
tmp.push_back(vo[i]);
int sumt = vo[i];
while(i-1 >= 0 && vo[i] >= vo[i-1]){
tmp.push_back(vo[i-1]);
sumt += vo[i-1];
i--;
}
if(sumt > sum || (sumt == sum && tmp.size() > tm.size())){
sum = sumt;
tm = tmp;
}
}
cout << "Day con khong giam co tong lon nhat la: " << sum << endl;
cout << "Cac phan tu day con la:\n";
for(int j = tm.size()-1; j >= 0; j--) cout << tm[j] << " ";
ofstream fout("Kqcb77.txt");
fout << "Day con khong giam co tong lon nhat la: " << sum << endl;
fout << "Cac phan tu day con la:\n";
for(int j = tm.size()-1; j >= 0; j--) fout << tm[j] << " ";
}
////////////////////
Cách 2:
#include
#include
#include
using namespace std;
int main() {
cout << "Chuong trinh tim day con khong giam co tong lon nhat va dai nhat\n";
ifstream fin("cb77.txt");
if (!fin.is_open()) {
cerr << "Khong mo duoc file cb77.txt\n";
return 0;
}
vectorvo;
int x;
while(fin >> x){
if(abs(x) > 1e7) {
cerr << "so " << x << " khong hop le \n";
continue;
}
vo.push_back(x);
}
fin.close();
if(vo.empty()){
cerr << "File khong co du lieu\n";
return 0;
}
int sum = 0, sumt = vo[0];
vectortm, tmp;
tmp.push_back(vo[0]);
for(int i = 1; i < vo.size(); i++){
if(vo[i] >= vo[i-1]){
tmp.push_back(vo[i]);
sumt += vo[i];
} else {
if(sumt > sum || (sumt == sum && tmp.size() > tm.size())){
sum = sumt;
tm = tmp;
}
tmp.clear();
tmp.push_back(vo[i]);
sumt = vo[i];
}
}
// kiểm tra dãy cuối
if(sumt > sum || (sumt == sum && tmp.size() > tm.size())){
sum = sumt;
tm = tmp;
}
cout << "Day con khong giam co tong lon nhat la: " << sum << endl;
cout << "Cac phan tu day con la:\n";
for(int v : tm) cout << v << " ";
ofstream fout("Kqcb77.txt");
fout << "Day con khong giam co tong lon nhat la: " << sum << endl;
fout << "Cac phan tu day con la:\n";
for(int v : tm) fout << v << " ";
}
///////////// Ai memory help
Võ Nhật Trường Nc+ My Ai Love09.07.2026
////////////////////
Bài 78. Tìm dãy con bằng nhau liên tiếp trong 1 dãy số. Yêu cầu : liệt kê các phần tử của dãy con bằng nhau. Tìm dãy con dài nhất và thông báo độ dài và dãy con đó.
Ví dụ:
Input: file cb78.txt vd: 2 2 2 9 6 6 -1-1 2 2 -1 2 3 3 3
Output: file Kqcb78.txt 2 2 2 || 6 6 || -1 -1 || 2 2 || 3 3 3 ; ….
Gợi ý code: #include
#include
#include
using namespace std;
int main() {
cout << "Chuong trinh tim day con lien tiep bang nhau\n";
ifstream fin("cb78.txt");
if (!fin.is_open()) {
cerr << "Khong mo duoc file cb78.txt\n";
return 0;
}
vectorvo;
int x;
while(fin >> x){
if(abs(x) > 1e7) {
cerr << "so " << x << " khong hop le \n";
continue;
}
vo.push_back(x);
}
if(vo.empty()){
cerr << "File khong co du lieu\n";
return 0;
}
fin.close();
int n=vo.size();
vectorvp(n+1,1);
for(int i=n-1;i>0;i--){
if(vo[i]==vo[i-1]) {
vp[i-1]+=vp[i]; }
}
vectorvt;
int max=1;
for(int k=0; k<n;k++){
if(vp[k]==max) {
vt.push_back(k);
}
if(vp[k]>max) {
max=vp[k];
vt.clear();
vt.push_back(k);
}
}
cout<
int i=0;
while(i<n){
if (vp[i]>1) {
cout<
for (int j=i; j
cout<<vo[j]<<" ";
cout<<endl;
i+=vp[i]-1;
}
i++ ;
}
cout<<endl;
if(max>1){
cout<
cout<
for(int c:vt){
for (int j=c; j
cout<<vo[j]<<" ";
cout<
}
} else cout<
ofstream fout("Kqcb78.txt");
fout<
i=0;
while(i<n){
if (vp[i]>1) {
fout<
for (int j=i; j
fout<<vo[j]<<" ";
fout<<endl;
i+=vp[i]-1;
}
i++ ;
}
fout<<endl;
if(max>1){
fout<
fout<
for(int c:vt){
for (int j=c; j
fout<<vo[j]<<" ";
fout<
}
} else fout<
}
///////////////////
Bài 78b. Tìm những dãy con có độ dài bằng nhau liên tiếp trong 1 dãy số. Yêu cầu : Tìm những dãy con bằng nhau liên tiếp dài nhất và thông báo độ dài và dãy con đó.
#include
#include
#include
using namespace std;
int main() {
cout << "Chuong trinh tim day con lien tiep bang nhau\n";
ifstream fin("cb78.txt");
if (!fin.is_open()) {
cerr << "Khong mo duoc file cb78.txt\n";
return 0;
}
vectorvo;
int x;
while(fin >> x){
if(abs(x) > 1e7) {
cerr << "so " << x << " khong hop le \n";
continue;
}
vo.push_back(x);
}
fin.close();
if(vo.empty()){
cerr << "File khong co du lieu\n";
return 0;
}
int maxLen = 1, curLen = 1;
vectorvt; // lưu vị trí bắt đầu các dãy dài nhất
for(int i=1; i
if(vo[i] == vo[i-1]){
curLen++;
} else {
if(curLen > maxLen){
maxLen = curLen;
vt.clear();
vt.push_back(i-curLen);
} else if(curLen == maxLen){
vt.push_back(i-curLen);
}
curLen = 1;
}
}
// kiểm tra dãy cuối
if(curLen > maxLen){
maxLen = curLen;
vt.clear();
vt.push_back(vo.size()-curLen);
} else if(curLen == maxLen){
vt.push_back(vo.size()-curLen);
}
if(maxLen > 1){
cout<
cout<
for(int start: vt){
for(int j=start; j
cout<<vo[j]<<" ";
cout<<"|| ";
}
} else {
cout<
}
}
///////////////////////////
Cách không tìm dãy con lớn nhất:
Bài 79. Tìm dãy con bằng nhau liên tiếp trong 1 dãy số. Yêu cầu : liệt kê các phần tử của dãy con bằng nhau.
Ví dụ:
Input: file cb78.txt vd: 2 2 2 9 6 6 -1-1 2 2 -1 2 3 3 3
Output: file Kqcb78.txt 2 2 2 || 6 6 || -1 -1 || 2 2 || 3 3 3 ; ….
#include
#include
#include
using namespace std;
int main() {
cout << "Chuong trinh tim day con lien tiep bang nhau\n";
ifstream fin("cb78.txt");
if (!fin.is_open()) {
cerr << "Khong mo duoc file cb78.txt\n";
return 0;
}
vectorvo;
int x;
while(fin >> x){
if(abs(x) > 1e7) {
cerr << "so " << x << " khong hop le \n";
continue;
}
vo.push_back(x);
}
if(vo.empty()){
cerr << "File khong co du lieu\n";
return 0;
}
fin.close();
int n=vo.size();
vectorvp(n+1,1);
for(int i=n-1;i>0;i--){
if(vo[i]==vo[i-1]) {
vp[i-1]+=vp[i]; }
}
cout<
int i=0;
while(i<n){
if (vp[i]>1) {
cout<
for (int j=i; j
cout<<vo[j]<<" ";
cout<<endl;
i+=vp[i]-1;
}
i++ ;
}
ofstream fout("Kqcb78.txt");
fout<
i=0;
while(i<n){
if (vp[i]>1) {
fout<
for (int j=i; j
fout<<vo[j]<<" ";
fout<<endl;
i+=vp[i]-1;
}
i++ ;
}
}
///////////// Ai memory help
Võ Nhật Trường Nc+ My Ai Love09.07.2026
////////////////////ok..
Bài 80. Cho dãy số n. Hãy in ra dãy số đảo ngược
Đếm số lần xuất hiện xuất hiện của mỗi phần tử trong dãy số.
Ví dụ:
Input: file cb80.txt vd: 22966
Output: file Kqcb80.txt 669222, so lan xuat hien 2 la 3, 9 la 1 va 6 la 2
Gợi ý code:
#include
#include
#include
using namespace std;
int dai(vectorsz){
return sz.size();
}
int main(int argc, char** argv) {
cout << "Chuong trinh dao nguoc so va dem\n";
ifstream fin("cb80.txt");
if (!fin.is_open()) {
cerr << "Khong mo duoc file cb80.txt\n";
return 0;
}
int x;
fin >> x;
if(abs(x) > 1e7) {
cerr << "so " << x << " khong hop le \n";
return 0; }
fin.close();
vectorv(10,0);
int dau=1;
if (x
int y=abs(x);
int z=0;
while(y>0) {
z=z*10+(y%10);
v[y%10]++;
y/=10;
}z=z*dau;
cout<
cout<
for(int i=0;i
if (v[i]!=0) {
cout<<"so "<<i<< " co so lan xuat hien la "<<v[i]<<endl;
}
}
ofstream fout("Kqcb80.txt");
fout<
fout<
for(int i=0;i
if (v[i]!=0) {
fout<<"so "<<i<< " co so lan xuat hien la "<<v[i]<<endl;
}
}
}
///////////////////////
Bài 82. Chèn x phần tử vào vị trí thứ k của dãy số a có n phần tử. Đưa ra số phần tử và dãy số a sau khi chèn.
Ví dụ:
Input: file cb82.txt
Output: file Kqcb82.txt
cb82.txt | Kqcb82.txt |
4 8 20 -67 36 25 4 6 5 9 3 7 90 -24 88 -54 (4 là vị trí thứ 4 (giữa 9 và 3) cần chèn, 8 20 -67 36 25 vào dãy | 4 6 5 8 20 -67 36 25 9 3 7 90 -24 88 -54 |
Gợi ý code:
#include
#include
#include
#include
#include
#include
#include
using namespace std;
int main() {
cout << "Chuong trinh chen day so vao vt k cua day so \n";
ifstream fin("cb82.txt");
if (!fin.is_open()) {
cerr << "Khong mo duoc file cb82.txt\n";
return 0;
}
vectorvo, ds, arr;
int k;
long long x,n;
long long line;
fin >> k;
fin.ignore(numeric_limits::max(), '\n');
while (fin >> x) {
vo.push_back(x);
if (fin.peek() == '\n') break;
}
while (fin >> n) {
if (abs(n) > 1e7) {
cerr << "so " << n << " khong hop le \n";
continue;
}
ds.push_back(n);
}
fin.close();
cout<<k<<endl;
for (int i = 0; i < vo.size(); i++) cout<<vo[i]<
cout<<endl;
for (int i = 0; i
arr.push_back(ds[i]);
for (auto c : vo) arr.push_back(c);
for (int i = k-1; i
arr.push_back(ds[i]);
cout << "Danh sach phan sau khi chen tai vi tri " << k << " la: \n";
for (auto c : arr) cout << c << " ";
cout << endl;
ofstream fout("Kqcb82.txt");
fout << "Danh sach phan sau khi chen tai vi tri " << k << " la: \n";
for (auto c : arr) fout << c << " ";
fout << endl;
fout.close();
}
Chú ý:
while (fin >> x) {
vo.push_back(x);
if (fin.peek() == '\n') break; // dừng khi hết dòng
}
Hoặc:
fin >> k;
fin.ignore(numeric_limits::max(), '\n'); // bỏ phần còn lại của dòng
getline(fin, line); // đọc dòng tiếp theo chứa dãy vo
stringstream ss(line);
while (ss >> x) {
vo.push_back(x);
}
///////////// Ai memory help
Võ Nhật Trường Nc+ My Ai Love09.07.2026
///////////////////
Bài 83. Xóa đi tất cả các phần tử chia hết cho k trong mảng có n phần tử. Đưa ra số phần tử còn lại và mảng a sau khi xóa.
Input: Cb83.txt | Output: Kqcb83.txt |
6 2 3 6 6 4 7 2 | 2 3 7 |
Gợi ý code:
#include <bits/stdc++.h>
using namespace std;
void xoa(int a[], int &n, int k){
for(int i=k+1; i<n;i++){
a[i-1]=a[i];
}
n--;
}
void xoaarr(int a[], int &n, int k){
for(int i=n-1; i>=0; i--){
if(a[i]%k==0){
xoa(a,n,i);
}
}
}
int main(){
int n, k;
int a[1000];
freopen("cb83.txt","r",stdin);
cin>>n>>k;
for(int i=0; i<n;i++){
cin>>a[i];
}
fclose(stdin);
xoaarr(a,n,k);
cout<<n<<endl;
for(int i=0;i<n;i++){
cout<<a[i]<<" ";
}
freopen("Kqcb83.txt","w",stdout);
cout<<n<<endl;
for(int i=0;i<n;i++){
cout<<a[i]<<" ";
}
fclose(stdout);
return 0;
}
/////////////////
Cách 2:
#include
#include
#include
using namespace std;
int main(int argc, char** argv) {
cout << "Chuong trinh tim va xoa cac phan tu chia het cho k\n";
ifstream fin("cb83.txt");
if (!fin.is_open()) {
cerr << "Khong mo duoc file cb83.txt\n";
return 0;
}
vectorvo;
int x,n,k;
fin>>n;
fin>>k;
while(fin >> x){
if(abs(x) > 1e7) {
cerr << "so " << x << " khong hop le \n";
fin.clear();
continue;
}
vo.push_back(x);
}
fin.close();
int m=vo.size()-1;
vo.push_back(-1);
while(m>=0){
if (vo[m]%k==0){
for(int j=m+1;j<vo.size();j++){
vo[j-1]=vo[j];
}
} m--;
}
vo.pop_back();
cout<
ifstream fout("Kq2cb83.txt");
cout<
fout.close();
}
///////////// Ai memory help
Võ Nhật Trường Nc+ My Ai Love09.07.2026
///////////////////
tmp.assign(vo.begin() + 5, vo.end() - 3);
hoặc
vector tmp(vo.begin() + 5, vo.end() - 3);
vector tmp(vo.size(), 1)
tmp.push_back(x)
/////////////////////////////////////////////////

Không có nhận xét nào:
Đăng nhận xét