手機號查詢

2021-10-24 06:30:56 字數 516 閱讀 9982

題目:

信服君接受一項任務需要製作乙個手機號碼查詢系統,輸入連續的數字後,需要顯示所有包含該連續數字的手機號。為了驗證演算法,信服君當前只需輸出手機號的個數即可。

注:直接用數學的查詢方式如果(phonenum [i] .find(test)!= string :: npos)會超時,只能ac80%,這裡用空間替換時間效率ac了100%。的連續組合方式,從而節省了找到的時間。

#include

using

namespace std;

intmain()

for(unordered_set

::iterator it=phone.

begin()

;it!=phone.

end();

++it)

}for

(auto p:c)m[p]++;

//計數

}while

(q--

)return0;

}

查詢手機號資訊2

新建乙個文字檔案phonenum.txt 裡面每一行寫乙個 號碼 寫完換行 coding utf 8 from phone import phone defgetphonenum file 讀取原始檔,獲取待查詢的手機號 try with open file r as f phonlist f.re...

java手機號歸屬地查詢

物件 public class phonemodel 省份名稱 param provincename 設定 provincename 屬性值為引數值 provincename public void setprovincename string provincename 城市名稱 return 獲取...

手機號判斷

public class smsutil toast.maketext activity,手機號碼輸入有誤!toast.length short show return false 驗證手機格式 public static boolean ismobileno string mobilenums 1...