2010년 10월 29일 금요일

Euler Problem 1

Euler Problem 1 ask;
If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.
Find the sum of all the multiples of 3 or 5 below 1000.

My Solution;
Sub Euler1()
   Dim a, b, c
   Dim SumA, SumB, SumC
   Dim Count, I  
   a = 3
   b = 5
   c = 15  
   Count = 999  
   For I = a To Count Step a
      SumA = SumA + I
   Next  
   For I = b To Count Step b
      SumB = SumB + I
   Next  
   For I = c To Count Step c
      SumC = SumC + I
   Next  
   MsgBox (SumA + SumB - SumC)
End Sub

댓글 없음:

댓글 쓰기

2.1 벡터(Vector)

  R의 자료구조 : 벡터, factor, 행렬, 배열, 데이터프레임, 리스트 벡터(Vector)는 동일한 형태(예, 숫자)의 데이터 구성인자가 1개 이상이면서 1차원으로 구성되어 있는 데이터 구조입니다. w <- c(1, 2, 3, 4, ...