Skip to content

Instantly share code, notes, and snippets.

@Terminus-IMRC
Created April 28, 2014 08:40
Show Gist options
  • Save Terminus-IMRC/11365670 to your computer and use it in GitHub Desktop.
Save Terminus-IMRC/11365670 to your computer and use it in GitHub Desktop.
nabeatsu-omp
#include <omp.h>
#include <stdio.h>
#define START 1
#define END 10000
int
main ()
{
int i, j, len;
char str[0xff];
_Bool f;
for (i = START; i <= END; i++)
{
printf ("%d: ", i);
if (i % 3 == 0)
f = 1;
else
{
f = 0;
len = snprintf (str, 0xff, "%d", i);
#pragma omp parallel for reduction(|:f)
for (j = 0; j < len; j++)
f |= str[j] == '3';
}
if (f)
printf ("aho");
putchar ('\n');
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment