Last active
August 29, 2015 14:19
-
-
Save rogerioagjr/3a0b9033800187e23dcc 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
#include <cstdio> | |
int main(){ | |
int n, resposta=0; // declaração de n e da resposta | |
scanf("%d", &n); // leio o valor de n na entrada | |
for(int i=1; i<=n; i++){ // para cada bandeja | |
int latas, copos; // declaro o valor de latas e de copos | |
scanf("%d %d", &latas, &copos); // leio o numero de latas e de copos | |
if(latas > copos) resposta+=copos; // se o número de latas for maior que o de copos, adicionamos os copos à resposta | |
} | |
printf("%d\n", resposta); // imprimos a resposta com quebra de linha para evitar runtime error | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment