标签:art print 进制 tco 二进制 etc leetcode min sprint
void recursion(int* t, int minute, int hour, int n, int cur, int start, char** arr, int* pst){ if (minute >= 60 || hour >= 12) return; if (cur == n){ char* s = (char*)calloc(10, sizeof(char)); int len = sprintf(s, "%d:", hour); if (minute <10) sprintf(s + len, "0%d", minute); else{ sprintf(s + len, "%d", minute); } arr[(*pst)++] = s; return; } for (int i = start; i <= cur + 10 - n; i++){ if (i<6) recursion(t, minute + t[i], hour, n, cur + 1, i + 1, arr, pst); else recursion(t, minute, hour + t[i], n, cur + 1, i + 1, arr, pst); } } char ** readBinaryWatch(int num, int* returnSize){ int t[] = { 1, 2, 4, 8, 16, 32, 1, 2, 4, 8 }; char** arr = (char**)calloc(1000, sizeof(char*)); int pst = 0; recursion(t, 0, 0, num, 0, 0, arr, &pst); *returnSize = pst; return arr; }
标签:art print 进制 tco 二进制 etc leetcode min sprint
原文地址:https://www.cnblogs.com/ganxiang/p/14058703.html