Skip to content

Instantly share code, notes, and snippets.

@rogerioagjr
Last active June 9, 2016 21:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rogerioagjr/9a13e84dfca18e1d88af43e7ae00dd89 to your computer and use it in GitHub Desktop.
Save rogerioagjr/9a13e84dfca18e1d88af43e7ae00dd89 to your computer and use it in GitHub Desktop.
Exemplo 2 - Sanduíche
int j=1;
for(int i=1;i<=n;i++)
while(j<2*n && prefix[j+1]-prefix[i-1]<=d) j++;
if(prefix[j]-prefix[i-1]==d) resp++;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment