카타 7급 Speed Control

1 C[ | ]

2 Kotlin[ | ]

3 R[ | ]

gps <- function(s, x) {
  if( length(x) < 2 ) return(0)
  floor( max(diff(x))*3600/s )
}
gps <- function(s, x) {
  if (length(x) <= 1) 0 else floor(max(3600 * diff(x) / s))
}
gps <- function(s, x) {
  if(length(x) <= 1) return (0)
  return(floor(max(((c(x[2:length(x)],0) - x) * 3600) / s)))
}
gps <- function(s, x) {
  max(floor((3600 * (x[-1] - x)[1:length(x)-1]) / s), 0)
}
문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}