Created
June 29, 2015 12:08
-
-
Save rogerioagjr/0f67430c599700ab7086 to your computer and use it in GitHub Desktop.
Pulo do Sapo
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> | |
#define MAXN 110 | |
bool marcado[MAXN]; | |
int n, m; | |
int main(){ | |
scanf("%d %d", &n, &m); // leio os valores de n e m | |
for(int i=1; i<=m; i++){ // para cada sapo | |
// declaro e leio seus valores de P e D | |
int p, d; | |
scanf("%d %d", &p, &d); | |
// e marco as pedras que ele pode alcançar | |
for(int i=p%d; i<=n; i+=d) | |
marcado[i]=true; | |
} | |
// depois imprimo os estado de cada pedra | |
for(int i=1; i<=n; i++) printf("%d\n", marcado[i]); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment