fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. /*chapter 6 version:
  4. tanjita
  5. tanyueqi
  6. tanguzheng
  7. laerhu
  8. chuidizi
  9. ne
  10. dian
  11. mai(sell)
  12. mai(buy)
  13. ba
  14. a
  15. ting
  16. yinyue
  17. keyi
  18. jiao
  19. xiexie */
  20. int main() {
  21. vector<string> v;
  22. string s;
  23. random_device rd;
  24. mt19937 gen(rd());
  25. while(cin>>s){
  26. v.push_back(s);
  27. }
  28. uniform_int_distribution<> distrib(1, v.size());
  29. set<int>ind;
  30. while(ind.size()<10){
  31. int x = distrib(gen);
  32. ind.insert(x);
  33. }
  34. for(int i: ind){
  35. cout<<v[i-1]<<endl;
  36. }
  37. return 0;
  38. }
Success #stdin #stdout 0.01s 5320KB
stdin
tanjita
tanyueqi
tanguzheng
laerhu
chuidizi
ne
dian
mai(sell)
mai(buy)
ba
a
ting
yinyue
keyi
jiao
xiexie
stdout
tanjita
tanguzheng
laerhu
ne
dian
mai(sell)
ba
a
yinyue
xiexie