Last active
August 25, 2020 11:44
-
-
Save ampulhetadosaber/8d7e3f74cb5467cb739ef5576e95d7df 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 | |
// 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