2017 BIT複試機試(軟體)

2021-08-16 15:12:57 字數 999 閱讀 6785

2023年:

1.輸入n(1<=n<=9),列印對應行數的三角形。要注意非法輸入。

2.輸入n,判斷n是否在n平方的右邊出現。比如1,5,6,25,都在它的平方最右側出現,就輸出yes,否則輸出no,這題好像跟前年的一樣,題目的敘述有點問題,當時好多人問老師來著。

3.輸入若干字串,以空格隔開,輸入回車結束,將字串按ascii碼表排列後輸出。比如輸入ac cf bgh\n,輸出ac bgh cf。

4.輸入字串,遞迴輸出它們的全排列(不可重複)。比如輸入abc,輸出abc,acb,bac,bca,cba,cab。測試樣例基本正常,有乙個比較奇怪,是abab,不知道該輸出什麼 1.

#includeint main()

for(int i=1;i<=n;i++)

}

2.

#includeint main()

p=num%o;

//printf("%d %d\n",p,n);

if(p==n)

printf("yes");

else

printf("no");

}

3.

#include#includevoid swap(char p,char q)

int main()

while(c!='\n');

for(i=0;i0)

swap(str[i],str[j]);

} }for(i=0;i#include#include char str[100];

void recu(char *r,int m,int n)

else

for(int j=n;jint main()

r=str;

//printf("%d\n",i);

// printf("piror:%s*",str);

recu(r,i,0);

}

2018 BIT複試機試

1 輸入乙個只含有英文本母的字串,輸出最大回文子串的長度及此長度回文子串的個數 回文不區分大小寫 樣例 輸入abaab 最大回文子串為baab 輸出4 1 輸入abcbbb 最大回文子串為bcb和bbb 輸出 3 2 實際測試樣例 輸入 a b 輸出 1 2 輸入 abcbb 輸出 3 1 輸入 a...

王道複試機試(2)

學號姓名排名 用sort函式 include include include using namespace std struct student student arr 100 bool compare student x,student y else return x.score int mai...

王道複試機試(7)

1.bfs寬度優先搜尋 include include include using namespace std void bfs int n myqueue.push current 10 myqueue.push current 10 1 int main return0 3的過程應該就是 右為隊...