Last active
August 25, 2020 11:41
-
-
Save ampulhetadosaber/4bd4ae256d385ef2757633c51c91dd6d to your computer and use it in GitHub Desktop.
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
// OBI 2008 - Nível Prog. Júnior - Fase 1 | |
// Problema: OBI | |
#include <iostream> | |
using namespace std; | |
int main() | |
{ | |
int n, p, x, y, ans = 0; // declaro as variáveis | |
cin >> n >> p; // leio N e P | |
int i = 0; // contador para sabermos quantas vezes já rodamos o while | |
while(i < n) | |
{ | |
cin >> x >> y; // leio o X e Y de cada competidor | |
x += y; // faço X receber a pontuação total | |
if(x >= p) | |
{ | |
ans++; // nossa resposta aumenta | |
} | |
i++; // nosso contador aumenta | |
} | |
cout << ans << "\n"; // imprimo a nossa resposta | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment