p14: some cleanup
This commit is contained in:
parent
296a8b84c3
commit
51117a7a67
1 changed files with 6 additions and 4 deletions
10
p14.c
10
p14.c
|
|
@ -12,15 +12,17 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#define MAX 1000000
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
|
|
||||||
/* working variables */
|
/* working variables */
|
||||||
int i, nlen, table[1000000] = {0, 1};
|
int i, nlen, table[MAX] = {0, 1};
|
||||||
int64_t n;
|
int64_t n;
|
||||||
/* result */
|
/* result */
|
||||||
int len = 0, rs = 0;
|
int len = 0, rs = 0;
|
||||||
|
|
||||||
for(i=2; i < 1000000; i++) {
|
for(i=2; i < MAX; i++) {
|
||||||
|
|
||||||
n = i;
|
n = i;
|
||||||
nlen = 1;
|
nlen = 1;
|
||||||
|
|
@ -38,12 +40,12 @@ int main() {
|
||||||
nlen++;
|
nlen++;
|
||||||
}
|
}
|
||||||
|
|
||||||
table[i] = nlen;
|
|
||||||
|
|
||||||
if (nlen > len) {
|
if (nlen > len) {
|
||||||
len = nlen;
|
len = nlen;
|
||||||
rs = i;
|
rs = i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
table[i] = nlen;
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("%i\n", rs);
|
printf("%i\n", rs);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue