Created
January 20, 2014 05:59
-
-
Save masaha03/8515617 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
otoshidama <- function(x) { | |
rank <- c("一等?", "二等?", "三等!", "三等!", "外れ") | |
tosen <- c(97085, 2344, 72, 74) | |
result <- NULL | |
for (i in x) { | |
tmp <- grep(sprintf(".*%s$", i), tosen) | |
tmp <- ifelse(length(tmp) == 0, 5, tmp) | |
result <- c(result, tmp) | |
} | |
cat("当選番号:", tosen, fill=TRUE) | |
cat(rank[result], sep="\n") | |
} | |
# 下二桁を入力 | |
otoshidama(c(72, 11, 85, 35, 44)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment