21t1020091PhamMinhTri
include <bits/stdc++.h>
using namespace std;
struct Node {
string sdt;
string hoten;
Node next;
};
Node first;
void insert(Node &first, string sdt, string hoten) { for (Node p = first; p != NULL; p = p->next) { if (p->sdt == sdt) return; } Node *q = new Node; q->sdt = sdt; q->hoten = hoten; q->next = first; first = q; }
void count(Node first) { int d = 0; for (Node p = first; p != NULL; p = p->next) d++; cout << d << "\n"; }
void find(Node first, string sdt) { for (Node p = first; p != NULL; p = p->next) { if (p->sdt == sdt) { cout << p->hoten << " " << p->sdt << "\n"; return; } } cout << "Not found\n"; }
void del(Node &first, string sdt) { Node p = first, *truoc = NULL; while (p != NULL) { if (p->sdt == sdt) { if (truoc == NULL) first = p->next; else truoc->next = p->next; delete p; return; } truoc = p; p = p->next; } }
int main() { string s; while (cin >> s) { if (s == "insert") { string sdt, hoten; cin >> sdt; cin.ignore(); getline(cin, hoten); insert(first, sdt, hoten); } else if (s == "count") { count(first); } else if (s == "find") { string sdt; cin >> sdt; find(first, sdt); } else if (s == "del") { string sdt; cin >> sdt; del(first, sdt); } else if (s == "fin") { return 0; } } } #include <bits/stdc++.h> using namespace std;
int main() { long long M; long long n; cin >> M >> n; long long a[n];
for (int i = 0; i < n; i++)
{
cin >> a[i];
}
int s = 0;
for (int i = 0; i < n; i++)
{
s += a[i];
}
long long tienthua = M - s;
long long nho = a[0];
for (int i = 1; i < n; i++)
{
if (a[i] < nho)
nho = a[i];
}
long long them = tienthua / nho;
cout << n + them << endl;
return 0;
}
Luyện tập
- Bài đã giải
- 3
- Chỉ tính bài đạt trọn điểm
- Hạng theo điểm
- #7.093
- Trong 16.548 thành viên
- Điểm
- 6
- Tính theo trọng số, xem tab Bài tập
Hoạt động
46 bài nộp trong 12 tháng qua
- Số ngày có bài nộp
- 9 ngày
- Ngày nhiều nhất
- 8 bài nộp, ngày 28/07/2026
- Tháng nhiều nhất
- 19 bài nộp, tháng 07/2026
| Tháng | Bài nộp | Số ngày có bài nộp |
|---|---|---|
| Tháng 11/2025 | 0 | 0 |
| Tháng 12/2025 | 0 | 0 |
| Tháng 01/2026 | 0 | 0 |
| Tháng 02/2026 | 0 | 0 |
| Tháng 03/2026 | 0 | 0 |
| Tháng 04/2026 | 0 | 0 |
| Tháng 05/2026 | 0 | 0 |
| Tháng 06/2026 | 10 | 2 |
| Tháng 07/2026 | 19 | 3 |
| Tháng 08/2026 | 17 | 4 |
| Tháng 09/2026 | 0 | 0 |
| Tháng 10/2026 | 0 | 0 |
| Tháng 11/2026 | 0 | 0 |