1027. Colors in Mars (20)時間限制400 ms記憶體限制32000 kB代碼長度限制16000 B判題程式Standard作者CHEN, YuePeople in Mars represent the colors in their computers in a similar way as the Earth people. That is, a color is represented by a 6-digit number, where the first 2
這題目還是慢有意思的。題目:如何判斷單鏈表裡面是否有環?演算法的思想是設定兩個指標p, q,其中p每次向前移動一步,q每次向前移動兩步。那麼如果單鏈表存在環,則p和q相遇;否則q將首先遇到null。這裡主要理解一個問題,就是為什麼當單鏈表存在環時,p和q一定會相遇呢?假定單鏈表的長度為n,並且該單鏈表是環狀的,那麼第i次迭代時,p指向元素i mod n,q指向2i mod n。因此當i=2i(mod n)時,p與q相遇。而i=2i(mod n) => (2i - i) mod n = 0
Calculate a + b and output the sum in standard format -- that is, the digits must be separated into groups of three by commas (unless there are less than four digits).InputEach input file contains one test case. Each case contains a pair of integers
1055. The World's Richest (25)時間限制200 ms記憶體限制128000 kB代碼長度限制16000 B判題程式StandardForbes magazine publishes every year its list of billionaires based on the annual ranking of the world's wealthiest people. Now you are supposed to simulate this job, but
1048. Find Coins (25)時間限制50 ms記憶體限制32000 kB代碼長度限制16000 B判題程式Standard作者CHEN, YueEva loves to collect coins from all over the universe, including some other planets like Mars. One day she visited a universal shopping mall which could accept all kinds
1046. Shortest Distance (20)時間限制100 ms記憶體限制32000 kB代碼長度限制16000 B判題程式Standard作者CHEN, YueThe task is really simple: given N exits on a highway which forms a simple cycle, you are supposed to tell the shortest distance between any pair of exits.Input
題目描述:請實現一個函數,將一個字串中的空格替換成“%20”。例如,當字串為We Are Happy.則經過替換之後的字串為We%20Are%20Happy。輸入:每個輸入檔案僅包含一組測試範例。對於每組測試案例,輸入一行代表要處理的字串。輸出:對應每個測試案例,出經過處理後的字串。範例輸入:We Are
1050. String Subtraction (20)時間限制10 ms記憶體限制32000 kB代碼長度限制16000 B判題程式StandardGiven two strings S1 and S2, S = S1 - S2 is defined to be the remaining string after taking all the characters in S2 from S1. Your task is simply to calculate S1 - S2 for
ORA-00604 error occurred at recursive SQL level string Cause:An error occurred while processing a recursive SQL statement (a statement applying to internal dictionary tables)。Action:If the situation described in the next error on the stack can be
1056. Mice and Rice (25)時間限制30 ms記憶體限制32000 kB代碼長度限制16000 B判題程式StandardMice and Rice is the name of a programming contest in which each programmer must write a piece of code to control the movements of a mouse in a given map. The goal of each mouse
1045. Favorite Color Stripe (30)時間限制200 ms記憶體限制32000 kB代碼長度限制16000 B判題程式Standard作者CHEN, YueEva is trying to make her own color stripe out of a given one. She would like to keep only her favorite colors in her favorite order by cutting off those