카타 7급 Deodorant Evaporator

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 }}