Skip to content

Instantly share code, notes, and snippets.

@ampulhetadosaber
Last active August 25, 2020 11:44
Show Gist options
  • Save ampulhetadosaber/8d7e3f74cb5467cb739ef5576e95d7df to your computer and use it in GitHub Desktop.
Save ampulhetadosaber/8d7e3f74cb5467cb739ef5576e95d7df to your computer and use it in GitHub Desktop.
// OBI 2008 - Nível Prog. Júnior - Fase 1
// Problema: OBI
// Solução utilizando o "for" como estrutura de repetição
#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
for(int i = 0 ; i < n ; i++)
{
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
}
}
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