parent
4449e40b69
commit
311721685d
@ -1,20 +0,0 @@ |
||||
./sig build 1 & |
||||
./sig build 2 & |
||||
./sig build 3 & |
||||
./sig build 4 & |
||||
./sig build 5 & |
||||
./sig build 6 & |
||||
./sig build 7 & |
||||
./sig build 8 & |
||||
./sig build 9 & |
||||
./sig build 10 & |
||||
./sig build 11 & |
||||
./sig build 12 & |
||||
./sig build 13 & |
||||
./sig build 14 & |
||||
./sig build 15 & |
||||
./sig build 16 & |
||||
./sig build 17 & |
||||
./sig build 18 & |
||||
./sig build 19 & |
||||
./sig build 20 & |
@ -0,0 +1,13 @@ |
||||
#include <stdio.h> |
||||
#include "utils.h" |
||||
|
||||
/*
|
||||
|
||||
|
||||
https://projecteuler.net/problem=
|
||||
*/ |
||||
|
||||
int main(int argc,char**argv) { |
||||
|
||||
return 0; |
||||
} |
@ -1,35 +0,0 @@ |
||||
#include <stdio.h> |
||||
#include "utils.h" |
||||
|
||||
/* |
||||
Starting in the top left corner of a 2×2 grid, and only being able to move to the right and down, there are exactly 6 routes to the bottom right corner. |
||||
|
||||
How many such routes are there through a 20×20 grid? |
||||
|
||||
|
||||
https://projecteuler.net/problem=14 |
||||
*/ |
||||
|
||||
void move(int x,int y,long*pathCount) { |
||||
if (x<21) { |
||||
move(x+1,y,pathCount); |
||||
} |
||||
if (y<21) { |
||||
move(x,y+1,pathCount); |
||||
} |
||||
if (x==20&&y==20) { |
||||
(*pathCount)++; |
||||
if (*pathCount%1000000==0) { |
||||
printf("%ld...",*pathCount); |
||||
} |
||||
} |
||||
} |
||||
|
||||
int main(int argc,char**argv) { |
||||
int x=0; |
||||
int y=0; |
||||
long pathCount=0; |
||||
move(x,y,&pathCount); |
||||
printf("\n\n%ld",pathCount); |
||||
return 0; |
||||
} |
@ -1,20 +0,0 @@ |
||||
1: 35345263800 |
||||
2: 17672631900 |
||||
3: 8597496600 |
||||
4: 4059928950 |
||||
5: 1855967520 |
||||
6: 818809200 |
||||
7: 347373600 |
||||
8: 141120525 |
||||
9: 54627300 |
||||
10: 20030010 |
||||
11: 6906900 |
||||
12: 2220075 |
||||
13: 657800 |
||||
14: 177100 |
||||
15: 42504 |
||||
16: 8855 |
||||
17: 1540 |
||||
18: 210 |
||||
19: 20 |
||||
20: 1 |
@ -1,40 +0,0 @@ |
||||
#include <stdio.h> |
||||
#include "utils.h" |
||||
|
||||
/*
|
||||
Starting in the top left corner of a 2×2 grid, and only being able to move to the right and down, there are exactly 6 routes to the bottom right corner. |
||||
|
||||
How many such routes are there through a 20×20 grid? |
||||
|
||||
|
||||
https://projecteuler.net/problem=14
|
||||
*/ |
||||
|
||||
void move(int x,int y,long*pathCount) { |
||||
if (x<21) { |
||||
move(x+1,y,pathCount); |
||||
} |
||||
if (x!=0&&y<21) { |
||||
move(x,y+1,pathCount); |
||||
} |
||||
if (x==20&&y==20) { |
||||
(*pathCount)++; |
||||
} |
||||
} |
||||
|
||||
int main(int argc,char**argv) { |
||||
int x=0; |
||||
int y=0; |
||||
int i=0; |
||||
int id=0; |
||||
while (argv[1][i]!='\0') { |
||||
y*=10; |
||||
y+=argv[1][i]-'0'; |
||||
i++; |
||||
} |
||||
id=y; |
||||
long pathCount=0; |
||||
move(x,y,&pathCount); |
||||
printf("\n\n%d:%ld",id,pathCount); |
||||
return 0; |
||||
} |
Loading…
Reference in new issue