Created
June 29, 2015 12:10
-
-
Save rogerioagjr/b2e661659201f4c03c95 to your computer and use it in GitHub Desktop.
Pulo do Sapo (Roger Benet)
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 pedras[110]; | |
int n,m; | |
void busca (int ini,int fim,int d){ | |
if(fim == n){ | |
while(ini <= fim){ | |
pedras[ini] = 1; | |
ini += d; | |
} | |
} | |
if(fim == 1) { | |
while(ini >= fim){ | |
pedras[ini] = 1; | |
ini -= d; | |
} | |
} | |
} | |
int main(){ | |
scanf("%d %d", &n, &m); | |
while(m-- > 0){ | |
int p,dis; | |
scanf("%d %d", &p, &dis); | |
busca(p,n,dis); | |
busca(p,1,dis); | |
} | |
for(int i = 1; i <= n; i++) | |
printf("%d\n",pedras[i]); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment