KY19 今年的第几天 https://www.nowcoder.com/practice/ae7e58fe24b14d1386e13e7d70eaf04d
KY222 打印日期 https://www.nowcoder.com/practice/b1f7a77416194fd3abd63737cdfcf82b
KY258 日期累加 https://www.nowcoder.com/practice/eebb2983b7bf40408a1360efb33f9e5d
KY210 排序 https://www.nowcoder.com/practice/508f66c6c93d4191ab25151066cb50ef
KY9 成绩排序 https://www.nowcoder.com/practice/3f27a0a5a59643a8abf0140b9a8cf1f7
KY158 找x https://www.nowcoder.com/practice/069e2130430c41229ab25e47fa0949a6
KY199 查找 https://www.nowcoder.com/practice/d93db01c2ee44e8a9237d63842aca8aa
二分查找
KY198 找最小数 https://www.nowcoder.com/practice/069e2130430c41229ab25e47fa0949a6
KY18 特殊乘法 https://www.nowcoder.com/practice/a5edebf0622045468436c74c3a34240f
KY33 密码翻译 https://www.nowcoder.com/practice/136de4a719954361a8e9e41c8c4ad855
KY90 简单密码 https://www.nowcoder.com/practice/ff99c43dd07f4e95a8f2f5448da3772a
KY113 字母统计 https://www.nowcoder.com/practice/de7bf0945c1c4bd1aa9d49573b831f3c
KMP——模式匹配算法
#include<iostream>
#include<cstdio>
#include<vector>
using namespace std;
int main() {
vector<int> myVector;
for (int i = 0; i < 5; i++) {
myVector.push_back(i);
}
cout << myVector.size();
myVector.insert(myVector.begin(), 3, 15); //头部插入3个15
myVector.pop_back();
// 访问向量中的 5 个值
for (int i = 0; i < 8; i++) {
cout << "value of vec [" << i << "] = " << myVector[i] << endl;
}
cout << " " << endl;
cout << "第五个元素:" << myVector[4] << endl;
cout << "向量大小:" << myVector.size() << endl;
myVector.erase(myVector.begin() + 5, myVector.end());
vector<int>::iterator it;
for (it = myVector.begin(); it != myVector.end(); it++) {
cout << *it << endl;
}
myVector.clear();
return 0;
}
KY20 完数VS盈数 https://www.nowcoder.com/practice/ccc3d1e78014486fb7eed3c50e05c99d
KY180 堆栈的使用 https://www.nowcoder.com/practice/e91982a145944ceab6bb9a4a508e0e26
KY187 二进制数 https://www.nowcoder.com/practice/103dd589fed14457a673c613d8de3841
KY235 进制转换2 https://www.nowcoder.com/practice/ae4b3c4a968745618d65b866002bbd32
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
using namespace std;
char intToChar(int x) {
if (x < 10) {
return x + '0';
} else {
return x - 10 + 'A';
}
}
int charToInt(char x) {
if (x >= '0' && x <= '9') {
return x - '0';
} else {
return x - 'A' + 10;
}
}
int main() {
int m, n;
cin >> m >> n ;
string str;
cin >> str;
long long number;
for (int i = 0; i < str.size(); i++) {
number *= m;
number += charToInt(str[i]);
}//转换为十进制
vector<char> result;//存结果
while (number != 0) {
result.push_back(intToChar(number % n));
number /= n;
}
for (int i = result.size() - 1; i >= 0; i--) {
cout << result[i];
}
return 0;
}