Advertisement
Guest User

Untitled

a guest
Oct 9th, 2015
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. #include<fstream>
  2. #include<string>
  3. #include<vector>
  4. using namespace std;
  5. ifstream cin("input.txt");
  6. ofstream cout("output.txt");
  7. int i, cnt, t;
  8. string s;
  9. bool fan1, fan2;
  10. vector <string> v;
  11. int main()
  12. {
  13. while (!cin.eof())
  14. {
  15. getline(cin, s);
  16. v[i] = s.substr(2, s.size() - 1);
  17. i++;
  18. }
  19. for (int j = 0; j < i; j++)
  20. for (int z = 0; z < i; z++)
  21. {
  22. if (v[j].size() <= v[z].size() && j != i)
  23. {
  24. for (int q = 0; q < v[j].size(); q++)
  25. if (v[j][q] == v[i][q]) cnt++;
  26. if (cnt == v[j].size()) fan1 = 1;
  27. cnt = 0;
  28. ////
  29. for (int w = v[z].size() - v[j].size(); w < v[z].size(); w++)
  30. {
  31. if (v[j][t] == v[z][i]) cnt++;
  32. t++;
  33. }
  34. if (cnt == v[j].size()) fan2 = 1;
  35. cnt = 0;
  36. t = 0;
  37. }
  38. }
  39. cout << "Прямое условие Фано ";
  40. if (fan1 == 1) cout << "не выполняется" << endl;
  41. else cout << "выполняется" << endl;
  42. //
  43. cout << "Обратоное условие Фано ";
  44. if (fan2 == 1) cout << "не выполняется" << endl;
  45. else cout << "выполняется" << endl;
  46. return 0;
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement