Last active
November 8, 2016 22:12
-
-
Save dyigitpolat/4b6212b433cbac090dd80cbdfbd2491b to your computer and use it in GitHub Desktop.
selam
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 <stdlib.h> | |
#include <stdio.h> | |
int main() | |
{ | |
int* randoms; | |
long max_length = 0; | |
long cur_length = 0; | |
int range = 10000; | |
long i; | |
randoms = (int*) malloc( sizeof(int) * 100000000L); | |
for(i = 0; i < 100000000L; ++i) | |
{ | |
randoms[i] = rand() % range + 1; | |
} | |
for(i = 0; i < 99999999L; ++i) | |
{ | |
if( randoms[i] < randoms[i+1L]) | |
{ | |
cur_length++; | |
} | |
else | |
{ | |
if( cur_length > max_length) | |
{ | |
max_length = cur_length; | |
cur_length = 0; | |
} | |
} | |
} | |
printf( "%ld\n", max_length); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment