题意:
24小时中,时、分和秒针重合次数是多少?分别是什么时候?
假设前提:时针每12分钟移动一格,每次移动后,会有11分59秒等待分钟来汇合;秒针和分钟也是相同情况~
code:
#include <iostream>
using namespace std;
int main() {
for(int h = 0; h < 24; h++) {
for(int m = 0; m < 60; m++) {
if(m == (int)((float)m/12.0) + (h % 12 * 5)) {
cout<<h<<":"<<m<<":"<<m<<endl;
}
}
}
}
3万+

被折叠的 条评论
为什么被折叠?



