Created
April 28, 2014 08:40
-
-
Save Terminus-IMRC/11365670 to your computer and use it in GitHub Desktop.
nabeatsu-omp
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 <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