카타 7급 Functions of Integers on Cartesian Plane

Jmnote (토론 | 기여)님의 2019년 4월 7일 (일) 21:00 판 (→‎R)

1 C

2 R

sumin <- function(n) {
  s = 0
  for(i in 1:n) {
    s = s+(2*(n-i)+1)*i
  }
  s
}

sumax <- function(n) {
  s = 0
  for(i in 1:n) {
    s = s+(2*i-1)*i
  }
  s
}

sumsum <- function(n) {
  s = 0
  for(i in 1:n) {
    for(j in 1:n) {
      s = s + i + j
    }
  }
  s
}
문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}