華為OJ 查詢兄弟單詞

2021-07-14 08:39:30 字數 790 閱讀 5363

查詢兄弟單詞

輸入描述:

先輸入字典中單詞的個數,再輸入n

個單詞作為字典單詞。

輸入乙個單詞,查詢其在字典中兄弟單詞的個數

再輸入數字n

輸出描述:

根據輸入,輸出查詢到的兄弟單詞的個數

輸入例子:3

abc

bca

cab

abc 1

輸出例子:2

bca

解答**

方法一:

#include#include#include#include#include#include#includeusing namespace std;

int judge(string findstring,string v)

int main()

cin>>findword;

cin>>index;

for(i=0; i#include#include#include#include#include#includeusing namespace std;

int judge(string findstring,string v)

int main()

sort(words.begin(),words.end());

cin>>findword;

cin>>index;

for(i=0; i=index)

cout<

華為OJ(查詢兄弟單詞)

描述 題目描述 知識點查詢 執行時間限制 10m記憶體限制 128輸入 先輸入字典中單詞的個數,再輸入n個單詞作為字典單詞。輸入乙個單詞,查詢其在字典中兄弟單詞的個數 再輸入數字n 輸出根據輸入,輸出查詢到的兄弟單詞的個數 輸出指定的第n個兄弟單詞 樣例輸入 3 abc bca cab abc 1 ...

華為OJ 查詢兄弟單詞

先輸入字典中單詞的個數,再輸入n個單詞作為字典單詞。輸入乙個單詞,查詢其在字典中兄弟單詞的個數 再輸入數字n 根據輸入,輸出 查詢到的兄弟單詞的個數及 include include include include include using namespace std int isbrother ...

華為oj 單詞倒排

題目描述 對字串中的所有單詞進行倒排。說明 1 每個單詞是以26個大寫或小寫英文本母構成 2 非構成單詞的字元均視為單詞間隔符 3 要求倒排後的單詞間隔符以乙個空格表示 如果原字串中相鄰單詞間有多個間隔符時,倒排轉換後也只允許出現乙個空格間隔符 4 每個單詞最長20個字母 樣例輸入 i am a s...