카타 7급 Powers of i

R[ | ]

pofi <- function(n){
  c('1','i','-1','-i')[n%%4+1]
}
pofi <- function(n){
  if(n %% 4 == 0) return("1");
  if(n %% 4 == 1) return("i");
  if(n %% 4 == 2) return("-1");
  if(n %% 4 == 3) return("-i");
}
pofi <- function(n){
  switch(n%%4+1,'1','i','-1','-i')
}
문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}