1039. Course List for Student (25)時間限制200 ms記憶體限制32000 kB代碼長度限制16000 B判題程式Standard作者CHEN, YueZhejiang University has 40000 students and provides 2500 courses. Now given the student name lists of all the courses, you are supposed to output the
Lake CountingTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 16090 Accepted: 8148DescriptionDue to recent rains, water has pooled in various places in Farmer John's field, which is represented by a rectangle of N x M (1 <= N <= 100; 1
This time, you are supposed to find A+B where A and B are two polynomials.InputEach input file contains one test case. Each case occupies 2 lines, and each line contains the information of a polynomial: K N1 aN1 N2 aN2 ... NK aNK, where K is the
題目描述:用兩個棧來實現一個隊列,完成隊列的Push和Pop操作。隊列中的元素為int類型。輸入:每個輸入檔案包含一個測試範例。對於每個測試範例,第一行輸入一個n(1<=n<=100000),代表隊列操作的個數。接下來的n行,每行輸入一個隊列操作:1. PUSH X 向隊列中push一個整數x(x>=0)2. POP 從隊列中pop一個數。輸出:對應每個測試案例,列印所有pop操作中從隊列pop中的數字。如果執行pop操作時,隊列為空白,則列印-1。範例輸入:3PUSH
這是一道面試題:刪除字串開始及末尾的空白符,並且把數組中間的多個空格(如果有)符轉化(合并)為1個。例如把“ I like python ! "變成”I like python !“。問題很明確,關鍵是要減少字元的移動次數。要減少字元的移動次數,如果能一次性就把字元移到準確地位置就好了,不要做不必要的移動。下面給出用python些的簡單代碼。#!/usr/bin/pythonimport sysdef rmblank(blankstr): new_start=0
1059. Prime Factors (25)時間限制50 ms記憶體限制32000 kB代碼長度限制16000 B判題程式Standard作者HE, QinmingGiven any positive integer N, you are supposed to find all of its prime factors, and write them in the format N = p1^k1* p2^k2 *…*pm^km.Input Specification:Each