Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int n;
- int a[1000];
- cin >> n;
- for(int i = 0; i < n; ++i){
- cin >> a[i];
- }
- int w;
- cin >> w;
- int q = 0;
- cin >> q;
- int r = 0;
- cin >> r;
- for(int i = 0; i < n; ++i){
- if(a[i]==w){
- q = q + 1;
- if(q == 2){
- r = i + 1;
- }
- }
- }
- if(q == 1 || q == 0){
- cout << "No solution";
- } else {
- cout << r;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement