// This question is exhausted and it cannot be found where Wa is !? (A good hit) // my idea is to restore the input led clock to a number and then perform matching one by one, some pruning operations can be performed in the process (for example, the first digit cannot be greater than 2, and the third digit cannot be greater than 6) // the correct time of the first clock is obtained, then subtract 15 minutes to get the time of the second clock, and then search for the number in the string of the second clock. If the number exists, add 1 to the number of matches. // if the number of matches is greater than 1 or 0, the not sure output. Otherwise, the correct time is output! // The written code is so disgusting that you don't want to read it. You should try your best to improve it in the future and be rational! (Your own code. All the data below has passed, but when you submit the code, WA will be included with other people's code.) # include "iostream" # include "string" using namespace STD; struct info {string up; string mid; string down; int num;} digit [10]; string num [9]; string ans; int C; string solve (string Str ); int find_digit (string STR, string str1); time on Int main () {// LED is represented by a string! Digit [0]. up = "_", digit [0]. mid = "|", digit [0]. down = "| _ |", digit [0]. num = 0; digit [1]. up = "", digit [1]. mid = "|", digit [1]. down = "|", digit [1]. num = 1; digit [2]. up = "_", digit [2]. mid = "_ |", digit [2]. down = "| _", digit [2]. num = 2; digit [3]. up = "_", digit [3]. mid = "_ |", digit [3]. down = "_ |", digit [3]. num = 3; digit [4]. up = "", digit [4]. mid = "| _ |", digit [4]. down = "|", Digit [4]. num = 4; digit [5]. up = "_", digit [5]. mid = "| _", digit [5]. down = "_ |", digit [5]. num = 5; digit [6]. up = "_", digit [6]. mid = "| _", digit [6]. down = "| _ |", digit [6]. num = 6; digit [7]. up = "_", digit [7]. mid = "|", digit [7]. down = "|", digit [7]. num = 7; digit [8]. up = "_", digit [8]. mid = "| _ |", digit [8]. down = "| _ |", digit [8]. num = 8; digit [9]. up = "_", digit [9]. mid = "| _ |", digit [9]. d Own = "_ |", digit [9]. num = 9; int TC, I, J, K, M, N, Q; CIN> TC; cin. get (); Info input; string STR [3]; string first [4], secoend [4]; int A [3] [3]; while (TC --) {c = 0; ans = ""; for (I = 0; I <3; I ++) STR [I]. clear (); for (I = 0; I <3; I ++) Getline (CIN, STR [I]); for (I = 0; I <9; I ++) num [I]. clear (); for (I = 0; I <9; I ++) // separate the input strings into numbers! {If (I = 4) continue; input. up. clear (); input. mid. clear (); input. down. clear (); if (I <4) {for (j = I * 3; j <3 * (I + 1); j ++) {input. up + = STR [0] [J]; input. mid + = STR [1] [J]; input. down + = STR [2] [J] ;}} if (I> 4) {for (j = (I-1) * 3 + 1; j <= 3 * I; j ++) {input. up + = STR [0] [J]; input. mid + = STR [1] [J]; input. down + = STR [2] [J] ;}for (j = 0; j <3; j ++) for (k = 0; k <3; k ++) A [J] [k] = 0; (K = 0; k <3; k ++) // match with or without a string on the position! If it is a space, it will be skipped; otherwise, the matching of characters {If (input. up [k] = '') continue; else {A [0] [k] = 1 ;}} for (k = 0; k <3; k ++) {If (input. mid [k] = '') continue; else {A [1] [k] = 1 ;}} for (k = 0; k <3; k ++) {If (input. down [k] = '') continue; else {A [2] [k] = 1 ;}} for (j = 0; j <10; j ++) // convert a character image to a number! {Bool upflag = true, midflag = true, downflag = true; For (k = 0; k <3; k ++) for (m = 0; m <3; M ++) {if (a [k] [m]! = 0) {If (k = 0 & digit [J]. up [m]! = Input. up [m]) upflag = false; If (k = 1 & digit [J]. Mid [m]! = Input. Mid [m]) midflag = false; If (k = 2 & digit [J]. Down [m]! = Input. down [m]) downflag = false ;}} if (upflag & midflag & downflag) num [I] + = (digit [J]. num + 48);} if (I = 0) {string temp; int Len = num [0]. length (); For (j = 0; j <Len; j ++) {If (Num [0] [J] <'3') temp. push_back (Num [0] [J]);} num [0]. clear (); num [0] + = temp;} if (I = 2) {string temp; int Len = num [2]. length (); For (j = 0; j <Len; j ++) {If (Num [2] [J] <'6') temp. push_back (Num [2] [J]) ;} Num [2]. clear (); num [2] + = temp;} bool FF = false; for (I = 0; I <num [0]. length (); I ++) // one-to-one character-number matching! {If (FF) break; For (j = 0; j <num [1]. length (); j ++) {If (FF) break; For (m = 0; m <num [2]. length (); m ++) {If (FF) break; For (n = 0; n <num [3]. length (); N ++) {string first = "", second = ""; first. push_back (Num [0] [I]); first. push_back (Num [1] [J]); first. push_back (Num [2] [m]); first. push_back (Num [3] [N]); Second = solve (first); int AA = find_digit (Second, First); If (AA> 1) {FF = true; cout <"Not sure" <Endl; break ;}}}if (C = 0) cout <"not sure" <Endl; if (C = 1) cout <ans <Endl ;}} string solve (string Str) // calculate the time of the second table at the correct time! {Int temp1, temp2, temp3, temp4; string temp = ""; temp1 = STR [3]-48; temp2 = STR [2]-48; temp3 = STR [1]-48; temp4 = STR [0]-48; If (temp1 <5) {temp1 + = 10; temp1-= 5; temp2-= 1;} else temp1-= 5; If (temp2 <1) {temp2 + = 6; temp2-= 1; temp3-= 1 ;} else temp2-= 1; if (temp3 <0) {If (temp4 = 1 | temp4 = 2) {temp3 + = 10; temp4-= 1 ;} else if (temp4 = 0) {temp3 + = 4; temp4 = 2;} temp. push_back (temp4 + 48); temp. push_back (temp3 + 48); temp. push_back (temp2 + 48); temp. push_back (temp1 + 48); Return temp;} int find_digit (string STR, string str1) // search for such a number in the second time string, if yes, add 1 to the number of matches! {Bool flag1 = false, flag2 = false, flag3 = false, flag4 = false; int I; for (I = 0; I <num [5]. length (); I ++) {If (STR [0] = num [5] [I]) {flag1 = true; break ;}} for (I = 0; I <num [6]. length (); I ++) {If (STR [1] = num [6] [I]) {flag2 = true; break ;}} for (I = 0; I <num [7]. length (); I ++) {If (STR [2] = num [7] [I]) {flag3 = true; break ;}} for (I = 0; I <num [8]. length (); I ++) {If (STR [3] = Num [8] [I]) {flag4 = true; break ;}} if (flag1 & flag2 & flag3 & flag4) {C ++; ans = str1;} return C ;} /* _ | | _ | | _ | _ | | _ | | ___ _ | | _ | | _ _ | ___ _ | _____ _ | _ _ | _ _ | * // * # Include <cstdio> # include <cstring> # include <vector> using namespace STD; int const num [15] = {119,36, 93,109, 46,107,123, 37,127,111}; int A [5], B [5], now [5] [15], BEF [5] [15], T1 [2] [100], T2 [2] [100]; int nowcnt [5], befcnt [5], t1cnt [2], t2cnt [2]; char STR [4] [30]; void add (char a, char B, char C, int & O, int X, int y, int Z) // calculate the right of O represented by this row {if (! = '') O + = (1 <X); If (B! = '') O + = (1 <Y); If (C! = '') O + = (1 <z);} int possinum (int A, int A []) // find the possible number of the defective led {int CNT = 0, I; for (INT I = 0; I <10; I ++) if (A & num [I]) | (a ^ num [I]) = num [I]) A [CNT ++] = I; return CNT;} void possitime (int x [5] [15], int y [2] [100], int xlen [], int ylen []) // save all hours and minutes to the array y {int I, j, H, M; for (I = 0; I <xlen [0]; I ++) for (j = 0; j <xlen [1]; j ++) {H = x [0] [I] * 10 + X [1] [J]; if (H <24) y [0] [ylen [0] ++] = H ;}for (I = 0; I <xlen [2]; I ++) for (j = 0; j <xlen [3]; j ++) {M = x [2] [I] * 10 + X [3] [J]; If (M <59) y [1] [ylen [1] ++] = m ;}} bool accurate (Int & H, Int & M) // determines whether there is a unique possible {int I, j, p, q, CNT = 0, H1, M1, H2, m2; memset (t1cnt, 0, sizeof (t1cnt); memset (t2cnt, 0, sizeof (t2cnt); possitime (now, T1, nowcnt, t1cnt); possitime (BEF, t2, befcnt, t2cnt); for (I = 0; I <t2cnt [0] & CNT <2; I ++) // The second minute for (j = 0; j <t2cnt [1] & CNT <2; j ++) {m2 = t2 [1] [J] + 15; H2 = t2 [0] [I]; if (M2> 59) {// processing carry H2 ++; M2 % = 60;} If (H2> 23) // It is written as 24 at the beginning, WA H2 = 0 at a time; for (P = 0; P <t1cnt [0] & CNT <2; p ++) for (q = 0; q <t1cnt [1] & CNT <2; Q ++) {M1 = T1 [1] [Q]; H1 = T1 [0] [p]; If (H1 = h2 & M1 = m2) {// compare whether equal CNT ++; H = h1, M = m1; If (CNT >= 2) return 0 ;}} if (CNT = 1) return 1; return 0;} void slove () {int I, j, H, M; for (I = 0; I <5; I ++) A [I] = B [I] = 0; for (I = 1; I <12; I + = 3) // two minutes are calculated, if (STR [0] [I]! = '') A [I/3] + = 1; for (++ I; I <25; I + = 3) if (STR [0] [I]! = '') B [(I/3) % 4] + = 1; for (I = 0; I <12; I + = 3) add (STR [1] [I], STR [1] [I + 1], STR [1] [I + 2], a [I/3], 1, 3, 2); For (++ I; I <25; I + = 3) add (STR [1] [I], STR [1] [I + 1], STR [1] [I + 2], B [(I/3) % 4], 1, 3, 2); for (I = 0; I <12; I + = 3) add (STR [2] [I], STR [2] [I + 1], STR [2] [I + 2], A [I/3], 4, 6, 5); For (++ I; I <25; I + = 3) add (STR [2] [I], STR [2] [I + 1], STR [2] [I + 2], B [(I/3) % 4], 4,6, 5 ); for (I = 0; I <4; I ++) {nowcnt [I] = possinum (A [I], now [I]); befcnt [I] = possinum (B [I], BEF [I]);} If (! Accurate (H, m) printf ("Not Sure \ n"); else {If (H/10 = 0) printf ("0 "); printf ("% d", H); If (M/10 = 0) printf ("0"); printf ("% d \ n", m );}} int main () {int T, I; scanf ("% d", & T); getchar (); While (t --) {for (I = 0; I <3; I ++) gets (STR [I]); slove ();} return 0 ;}*/