Skip to content

Instantly share code, notes, and snippets.

@ampulhetadosaber
Last active August 25, 2020 11:41
Show Gist options
  • Save ampulhetadosaber/4bd4ae256d385ef2757633c51c91dd6d to your computer and use it in GitHub Desktop.
Save ampulhetadosaber/4bd4ae256d385ef2757633c51c91dd6d to your computer and use it in GitHub Desktop.
// 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