"카타 7급 Deodorant Evaporator"의 두 판 사이의 차이

잔글 (봇: 자동으로 텍스트 교체 (-source +syntaxhighlight))
 
(다른 사용자 한 명의 중간 판 3개는 보이지 않습니다)
1번째 줄: 1번째 줄:
==C==
==C==
{{카타|7급|C|2}}
{{카타|7급|C|2}}
<source lang='c'>
<syntaxhighlight lang='c'>
</source>
#include <math.h>
int evaporator(double content, double evap_per_day, double threshold) {
  return ceil(log(threshold/100) / log(1 - evap_per_day/100)); 
}
</syntaxhighlight>
<syntaxhighlight lang='c'>
int evaporator(double content, double evap_per_day, double threshold) {
    double ratio = 100;
    int day = 0;
    while( ratio > threshold ) {
      ratio *= 1 - evap_per_day/100;
      day++;
    }
    return day;
}
</syntaxhighlight>
 
==Kotlin==
{{카타|7급|Kotlin|1}}
<syntaxhighlight lang='kotlin'>
</syntaxhighlight>
<syntaxhighlight lang='kotlin'>
</syntaxhighlight>
<syntaxhighlight lang='kotlin'>
</syntaxhighlight>


==R==
==R==
{{카타|7급|R|1}}
{{카타|7급|R|1}}
<source lang='r'>
<syntaxhighlight lang='r'>
evaporator <- function(content, evap_per_day, threshold) {
  ceiling(log(threshold / 100, 1 - evap_per_day / 100))
}
</syntaxhighlight>
<syntaxhighlight lang='r'>
evaporator <- function(content, evap_per_day, threshold) {
evaporator <- function(content, evap_per_day, threshold) {
   ceiling(log(threshold / 100.0) / log(1.0 - evap_per_day / 100.0))
   ceiling(log(threshold / 100.0) / log(1.0 - evap_per_day / 100.0))
}
}
</source>
</syntaxhighlight>
<source lang='r'>
<syntaxhighlight lang='r'>
evaporator <- function(content, evap_per_day, threshold) {
evaporator <- function(content, evap_per_day, threshold) {
   ratio <- 100
   ratio <- 100
21번째 줄: 50번째 줄:
   day
   day
}
}
</source>
</syntaxhighlight>

2020년 11월 2일 (월) 02:41 기준 최신판

1 C[ | ]

#include <math.h>
int evaporator(double content, double evap_per_day, double threshold) {
  return ceil(log(threshold/100) / log(1 - evap_per_day/100));  
}
int evaporator(double content, double evap_per_day, double threshold) {
    double ratio = 100;
    int day = 0;
    while( ratio > threshold ) {
      ratio *= 1 - evap_per_day/100;
      day++;
    }
    return day;
}

2 Kotlin[ | ]

3 R[ | ]

evaporator <- function(content, evap_per_day, threshold) {
  ceiling(log(threshold / 100, 1 - evap_per_day / 100))
}
evaporator <- function(content, evap_per_day, threshold) {
  ceiling(log(threshold / 100.0) / log(1.0 - evap_per_day / 100.0))
}
evaporator <- function(content, evap_per_day, threshold) {
  ratio <- 100
  day <- 0
  while( ratio > threshold ) {
    ratio <- ratio * (100 - evap_per_day) / 100
    day <- day + 1
  }
  day
}
문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}