Advertisement
Guest User

Untitled

a guest
Feb 20th, 2020
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. int n;
  8. int a[1000];
  9. cin >> n;
  10. for(int i = 0; i < n; ++i){
  11. cin >> a[i];
  12. }
  13. int w;
  14. cin >> w;
  15. int q = 0;
  16. cin >> q;
  17. int r = 0;
  18. cin >> r;
  19. for(int i = 0; i < n; ++i){
  20. if(a[i]==w){
  21. q = q + 1;
  22. if(q == 2){
  23. r = i + 1;
  24. }
  25. }
  26. }
  27. if(q == 1 || q == 0){
  28. cout << "No solution";
  29. } else {
  30. cout << r;
  31. }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement