Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* nuttela - Soham Chakrabarti */
- #include <bits/stdc++.h>
- using namespace std;
- #define IO ios_base::sync_with_stdio(false);cin.tie(NULL);
- #define endl '\n'
- typedef long long ll;
- typedef long double ld;
- typedef pair <int, int> pii;
- const int N = 1e3;
- const int inf = -1;
- const int MOD = 1e9 + 7;
- int main() {
- int n, k; cin >> n >> k;
- int a[n];
- for (int i = 0; i < n; ++i)
- {
- cin >> a[i];
- }
- bool ok = false;
- for (int i = n - 1; i >= 0; --i)
- {
- if (a[i] == k) {
- cout << (i + 1);
- ok = true;
- break;
- }
- }
- if (!ok) cout << 0;
- return 0;
- }
Add Comment
Please, Sign In to add comment