## codewars062 - Fizz Buzz Cuckoo Clock 原

圣洁之子

### Instructions

``````https://www.codewars.com/kata/fizz-buzz-cuckoo-clock/train/java
``````

### Solution:

``````public class FizzBuzzCuckooClock {
public static String fizzBuzzCuckooClock(String time) {

StringBuilder sb = new StringBuilder();
String[] arr = time.split(":");
Integer hrs = Integer.valueOf(arr[0]);
Integer mins = Integer.valueOf(arr[1]);
if (mins == 0) {
if (hrs == 0) {
hrs = 12;
}
if (hrs > 12) {
hrs = hrs - 12;
}
for (int i = 0; i < hrs; i++) {
sb.append("Cuckoo ");
}
} else if (mins == 30) {
sb.append("Cuckoo ");
} else if (mins % 3 == 0 && mins % 5 == 0) {
sb.append("Fizz Buzz ");
} else if (mins % 3 == 0) {
sb.append("Fizz");
} else if (mins % 5 == 0) {
sb.append("Buzz");
} else {
sb.append("tick");
}
return sb.toString().trim();

}
}

``````

### Sample Tests:

``````https://www.codewars.com/kata/fizz-buzz-cuckoo-clock/train/java
``````

### 圣洁之子

LeetCode：Fizz Buzz - Fizz Buzz 游戏

1、题目名称 Fizz Buzz（Fizz Buzz 游戏） 2、题目地址 https://leetcode.com/problems/fizz-buzz/ 3、题目内容 英文： Write a program that outputs the string representation of number......

2016/11/23
54
0
Lintcode9 Fizz Buzz solution 题解

【题目描述】 Given number n. Print number from 1 to n. But: when number is divided by 3, print "fizz". when number is divided by 5, print "buzz". when number is divided by both ......

coderer
2017/04/19
0
0

2018/01/03
0
0

alazyer
2014/05/05
397
0
LeetCode算法题-Fizz Buzz（Java实现）

01/05
0
0

12分钟前
0
0
Java 帝国对 Python 的渗透能成功吗？哈哈

5
0

6
0
linux 操作系统 常用命令和软件安装

1.系统时间更新 ntpdate time.windows.com 2.传送文件 rsync -av /home/data/a.dat -e ssh root@192.168.0.100:/home 3.传送文件夹 scp -r /home/data root@192.168.0.100:/home 4.JDK安装 ......

WJtiny

3
0
pg_lightool基于basebackup的单表恢复和块恢复