日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

中国电信IT研发中心 2019校园招聘笔试F卷 编程题-2018.09.10

發布時間:2024/3/26 编程问答 37 豆豆
生活随笔 收集整理的這篇文章主要介紹了 中国电信IT研发中心 2019校园招聘笔试F卷 编程题-2018.09.10 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

#include <bits/stdc++.h> using namespace std; int arr[26]; int main() {string str;cin >> str;vector<int> vec;for(int i=0; i<str.size(); i++){int temp = str[i]-'a';arr[temp]++;}int minNum = 0;//找出最少的字符 一定要排除字符數量為0的情況for(int i=0; i<26; i++){if(arr[i] != 0){minNum = i;break;}}for(int i=0; i<26; i++){if(arr[i] < arr[minNum] && arr[i] != 0)minNum = i;}//將數量最少的字符對應的數字全部加入vecfor(int i=0; i<26; i++){if(arr[i] == arr[minNum])vec.push_back(i);}for(int i=0; i<str.size(); i++){bool flag = true;int temp = str[i]-'a';for(int j=0; j<vec.size(); j++){//判斷字符是否主要刪除if(vec[j] == temp){flag = false;break;}}if(flag)cout << str[i];}return 0; }


劍指offer原題 牛客網題解 點擊鏈接

#include <iostream> #include <vector> #define min(a, b) (a<b ? a : b); using namespace std; int getUglyNumber(int index) {if(index < 7)return index;vector<int> res(index);res[0] = 1;int t2 = 0, t3 = 0, t5 = 0, i;for(i = 1; i < index; ++i){int minTemp = min(res[t2]*2, res[t3]*3);res[i] = min(res[t5]*5, minTemp);if(res[i] == res[t2]*2)t2++;if(res[i] == res[t3]*3)t3++;if(res[i] == res[t5]*5)t5++;}return res[index - 1]; }int main() {int n;cin >> n;cout << getUglyNumber(n) << endl;return 0; }

KMP擴展
參考鏈接1
參考鏈接2

總結

以上是生活随笔為你收集整理的中国电信IT研发中心 2019校园招聘笔试F卷 编程题-2018.09.10的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。