Created
April 9, 2019 18:27
-
-
Save luciocf/d8c7a2cb914374301cee90adc82a13f5 to your computer and use it in GitHub Desktop.
Noic - Iniciante - Semana 50 - Problema 1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Noic - Iniciante - Semana 50 - Problema 1 | |
// O(n) | |
#include <bits/stdc++.h> | |
using namespace std; | |
const int maxn = 110; | |
int l[maxn], r[maxn]; | |
int main(void) | |
{ | |
int n, k; | |
cin >> n; | |
for (int i = 1; i <= n; i++) | |
cin >> l[i] >> r[i]; | |
cin >> k; | |
int ind; // capítulo que contém k | |
for (int i = 1; i <= n; i++) | |
if (l[i] <= k && k <= r[i]) | |
ind = i; | |
cout << n-ind+1 << "\n"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment