fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. struct ThiSinh {
  5. string ten, ngaysinh, gioitinh;
  6. };
  7.  
  8. int main() {
  9. freopen("BAI3.INP","r",stdin);
  10. freopen("BAI3.OUT","w",stdout);
  11. int n;
  12. cin >> n;
  13. cin.ignore();
  14. vector<ThiSinh>ds;
  15. for (int i=0;i<n;i++) {
  16. string s;
  17. getline(cin,s);
  18. stringstream ss(s);
  19. string ten,ngaysinh,gioitinh,monthi;
  20. getline(ss,ten,'#');
  21. getline(ss,ngaysinh,'#');
  22. getline(ss,gioitinh,'#');
  23. getline(ss,monthi);
  24. if (monthi=="Tin") {
  25. ds.push_back({ten,ngaysinh,gioitinh});
  26. }
  27. }
  28. if (ds.empty()) {
  29. cout << "#";
  30. } else {
  31. cout << "Mon thi chuyen: Tin hoc" << endl;
  32. cout << "Thong tin thi sinh:" << endl;
  33. for (auto x:ds) {
  34. cout << x.ten << "@" << x.gioitinh << "@" << x.ngaysinh << endl;
  35. }
  36. cout << "Danh sach gom co: " << ds.size() << " thi sinh";
  37. }
  38. }
  39.  
Success #stdin #stdout 0.01s 5276KB
stdin
8
Ho Thao Nguyen#19/03/2005#Nu#Toan
Nguyen Van Sang#25/01/2005#Nam#Van
Le Quang Dai#12/12/200S#Nam#Anh
Vu Anh Tam#01/10/2005#Nam#Ly
Tran Thi Cam Tu#02/05/2005#Nu#Tin
Pham Cong Thien#25/09/2005#Nam#Hoa
Nguyen Gia Nhi#03/03/2005#Nu#Sinh
Vo Minh Khang#26/08/2005#Nam#Tin
stdout
Standard output is empty