N位同學站成一排,音樂老師要請其中的(N-K)位同學出列,使得剩下的K位同學排成合唱隊形。 合唱隊形是指這樣的一種隊形:設K位同學從左到右依次編號為1,2…,K,他們的身高分別為T1,T2,…,TK, 則他們的身高滿足T1 < T2 < ...< Ti > Ti+1 > … > TK (1 <= i <= K)。 你的任務是,已知所有N位同學的身高,計算最少需要幾位同學出列,可以使得剩下的同學排成合唱隊形。 Input 輸入包含若干個測試用例。 對于每個測試用例,輸入第一行是一個整數(shù)N(2<=N<=100),表示同學的總數(shù)。第二行有N個整數(shù),用空格分隔,第i個整數(shù)Ti(130<=Ti<=230)是第i位同學的身高(厘米)。當輸入同學總數(shù)N為0時表示輸入結束。 Output 對于每個測試案例,輸出包括一行,這一行只包含一個整數(shù),就是最少需要幾位同學出列。 Sample Input 8 186 186 150 200 160 130 197 220 3 150 130 140 0 Sample Output 4 1
標簽:
上傳時間: 2016-12-06
上傳用戶:jackgao
// 入口參數(shù): // l: l = 0, 傅立葉變換 l = 1, 逆傅立葉變換 // il: il = 0,不計算傅立葉變換或逆變換模和幅角;il = 1,計算模和幅角 // n: 輸入的點數(shù),為偶數(shù),一般為32,64,128,...,1024等 // k: 滿足n=2^k(k>0),實質上k是n個采樣數(shù)據(jù)可以分解為偶次冪和奇次冪的次數(shù) // pr[]: l=0時,存放N點采樣數(shù)據(jù)的實部 // l=1時, 存放傅立葉變換的N個實部 // pi[]: l=0時,存放N點采樣數(shù)據(jù)的虛部 // l=1時, 存放傅立葉變換的N個虛部 // // 出口參數(shù): // fr[]: l=0, 返回傅立葉變換的實部 // l=1, 返回逆傅立葉變換的實部 // fi[]: l=0, 返回傅立葉變換的虛部 // l=1, 返回逆傅立葉變換的虛部 // pr[]: il = 1,i = 0 時,返回傅立葉變換的模 // il = 1,i = 1 時,返回逆傅立葉變換的模 // pi[]: il = 1,i = 0 時,返回傅立葉變換的輻角 // il = 1,i = 1 時,返回逆傅立葉變換的輻角
上傳時間: 2017-01-03
上傳用戶:ynsnjs
void insert_sort(int *a,int n) { if(n==1) return insert_sort(a,n-1) int temp=a[n-1] for(int i=n-2 i>=0 i--) { if(temp<a[i]) a[i+1]=a[i] else break } a[i+1]=temp }
標簽: insert_sort int return void
上傳時間: 2014-01-22
上傳用戶:banyou
1、 有n個學生,每個學生有m門成績,每個學生的m門成績用一單鏈表實現(xiàn),n個學生所對應n個單鏈表的頭指針用一指針數(shù)組統(tǒng)一存放。 1) 建立該存貯結構。 2) 查找第i個學生的某門課成績。 鏈表中結點結構: struct node {char *nam;/*nam為課程名*/ float sco;/*sco為該門課程的成績*/ struct node *link;/*link為指向下一課程結點的指針*/
標簽:
上傳時間: 2013-12-14
上傳用戶:TF2015
有n個選手 P 1 ,P 2 ,P 3 ,… ,P n 參加了的單循環(huán)賽,每對選手之間非勝即負?,F(xiàn)要求求出一個選手序列 P 1 ,P 2 ,P 3 ,… ,P n , 使其滿足 P i 勝 P i+ 1 (i=1,… ,n-1) 。
標簽: 循環(huán)
上傳時間: 2014-11-07
上傳用戶:caozhizhi
單片機I@C程序庫,很容易移槙,我已用過N多次,很好用
上傳時間: 2013-12-18
上傳用戶:xiaoxiang
Measuring Frequency Content in Signals I this section we will study some non parametric methods for spectrum estimation of a stochastic process. These methods are described in the literature. All methods are based on the Periodogram which is defined for a sequence x[n] with length N according to
標簽: parametric Measuring Frequency Content
上傳時間: 2017-03-20
上傳用戶:秦莞爾w
I was trying to develope a programme to make a slide show of all the pictures of a folder using vb.net. I have spent lot of time in net for searching this but all in vain, I didn t get a simple programme to solve the same and lastly I gave myself a try for the same and developed the code, I have used there a folderbrowserdialogue and a timer with a picture box control and in coding I have used IO name spaces to get the pathe and folder info here is the code. Enjoy Subhankar
標簽: programme develope pictures trying
上傳時間: 2017-04-24
上傳用戶:a3318966
需對容量為c 的背包進行裝載。從n 個物品中選取裝入背包的物品,每件物品i 的重量為wi ,價值為pi 。對于可行的背包裝載,背包中物品的總重量不能超過背包的容量,最佳裝載是指所裝入的物品價值最高。
標簽: 容量
上傳時間: 2013-12-01
上傳用戶:iswlkje
生成Trick文件工具 1.Open command line 2.input tricktest Usage: TrickTest -f -o -i -f source mpeg2 file to trick -o trick output directory -i output file id -m max coding error, default 0 -b max bitrate for trick generate, default 0 mean no limit -s trick buffer block size, must be n*188 -l log file, default c:\tricktest.log example: tricktest -f 黑鷹行動.mpg -o c:\temp -i A -m 1000 -b 3750000 soure file: 黑鷹行動.mpg output directory: c:\temp filename: 000000A,000000A.ff,000000A.fr,000000A.vvx max coding error: 1000 trick generation speed: 3750000 bps a
標簽: TrickTest tricktest command source
上傳時間: 2014-01-23
上傳用戶:水口鴻勝電器