Posts

Showing posts from February, 2015

Thinking of Project Euler after a month from starting time

It took a month to solve problems 1 to 67. And I want to tell you the advantage of it
1. I learned math a lot from it. 2. Simplify my dirty source. 3. Clearly thinking coumputer language. 4. some algorithm
My first plan is to solve one hundred problems. I can do it~!!!
:)

Solved 54 problem

this is about the rule of poker

I wrote ideas and logic on my book and
coded.

My source was to get the real answer and
later on I will change my code to have no duplication code!!!

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205…

Sieve of Eratoshenes

A prime number (or a prime) is a natural number greater than 1 that has no positive divisors other than 1 and itself.

I want to find Prime number from 2, 3, .... To  N

First we need to make
new int [N];

like this ~ we visit all number of Array.

below is my code

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31/** * 1== prime * * @return */publicstaticint[]isPrimeFromSieve(int limit){int[] val =newint[limit];for(int i =2; i < val.length; i++){if(val[i]==0){ val[i]=1; checkMultiple(i, val);}}return val;}privatestaticvoidcheckMultiple(int a,int[] val){for(int i =2; i < val.length; i++){int num = a * i;if(num >= val.length){return;} val[num]=2;}}

I had very hard time to completely solved 50problems.
What I got from those problems is clearly coding skill.
I think it is very good to think. I will do more and more

My progress euler 2days

I started it 02/06/2014

If you are interested in Algorithm and math
visit this site is https://projecteuler.net/

really fun and interesting

My 2days solved is

Topcoder Srm 626 div2 500 problem

When I tried to solve this problem, I didn't exactly know about expected value.
know I can liite understand it

problem is get expected value if A value is larger than B

A. 2 sided
B. 2 sided

case is (2,1)
so expected value is 2

A. 4-sided
B. 2-sided

(4,1) (4,2) (3,1) (3,2) (2,1)
4+4+3+3+2 / 5 = 3.2

this is what i learn from this problem.

My one plan for this year~

these days. I started to study algorithm. I am 32years old. my first thought was too old to learn algorithm.
But I decided to study it.
I know this comment and believe it.

Beginning is half done

I will do my best.

and also I will get over 1500 ratings in Topcoder.
Now my rating is 568.

Don't worry~!!

DO IT DO IT.