1. 程式人生 > >攔截導彈

攔截導彈

驗證 color php code 問題 pan rri nyist pri

http://acm.nyist.net/JudgeOnline/problem.php?pid=79

不明白哪兒有問題,有待驗證

 1 #include <stdio.h>
 2 
 3 int floor = 0;
 4 void recurring(int missile[],int begin,int size,int& cur){
 5     ++cur;
 6     if(begin >= size - 1)
 7         return ;
 8     int i;
 9     for(i = begin; i < size; i++){
10 if(missile[i] < missile[begin]){ 11 recurring(missile,i,size,cur); 12 floor = (floor > cur) ? floor : cur; 13 --cur; 14 } 15 } 16 } 17 18 int main(){ 19 int N; 20 int m; 21 int missile[50]; 22 int i,cur; 23 scanf("%d"
,&N); 24 while(N--){ 25 scanf("%d",&m); 26 cur = 0; 27 for(i = 0; i < m; i++) 28 scanf("%d",&missile[i]); 29 recurring(missile,0,m,cur); 30 printf("%d\n",floor); 31 floor = 0; 32 } 33 return 0; 34 }

攔截導彈