fork download
  1. #include <iostream>
  2. #include <iomanip>
  3. #include <set>
  4.  
  5. using namespace std;
  6.  
  7. #define ll long long
  8. #define lld long double
  9. #define ull unsigned long long
  10. #define ulld unsigned long double
  11. #define us unsigned short
  12.  
  13. struct Atom
  14. {
  15. lld x, y, z;
  16. };
  17.  
  18. bool operator <(const Atom& a, const Atom& b)
  19. {
  20. return tie(a.x,a.y,a.z) < tie(b.x,b.y,b.z);
  21. }
  22.  
  23. int main()
  24. {
  25. setlocale(LC_ALL, "ru");
  26. set <Atom> set_cell;
  27. us cnt_atoms_cell, cellside_x, cellside_y, cellside_z;
  28. cout << "Введите количество атомов в элементарной ячейке: ";
  29. cin >> cnt_atoms_cell;
  30. cout << "Введите размеры сторон элементарной ячейки: ";
  31. cin >> cellside_x >> cellside_y >> cellside_z;
  32. cout << "Введите координаты атомов элементарной ячейки: " << endl;
  33. for (int n = 0; n < cnt_atoms_cell; ++n)
  34. {
  35. Atom atom;
  36. cin >> atom.x >> atom.y >> atom.z;
  37. set_cell.insert(atom);
  38. }
  39. return 0;
  40. }
  41.  
Success #stdin #stdout 0.07s 5520KB
stdin
Standard input is empty
stdout
Введите количество атомов в элементарной ячейке: Введите размеры сторон элементарной ячейки: Введите координаты атомов элементарной ячейки: