下载地址:chriszt/securec: openEuler使用的开源安全函数 (github.com)
题目:整理工号
1.C++
// 1808. 整理工号 #include "vector" #include "string" #include "iostream" using namespace std; vector<string> RegularID(vector<string>& inputs) { return vector<string>(); } inline std::string ReadLine() { std::string line; std::getline(std::cin, line); return line; } inline std::vector<std::string> ReadLines(int size) { std::vector<std::string> lines(size); for (int i=0; i<size; ++i) { lines[i] = ReadLine(); } return lines; } inline std::vector<std::string> ReadCountedLines() { std::string numberLine = ReadLine(); int count = std::stoi(numberLine); return ReadLines(count); } int main() { vector<string> inputs = ReadCountedLines(); vector<string> results = RegularID(inputs); for (const auto& res : results) { cout << res << endl; } return 0; } /* 8 ss789 12n00 s00123 k2 3490 S123 s234 x235 m990 */
2. C
#include ".\lib\securec-master\include\securec.h" #define MAXN 100 #define BUF_LEN 32 void RecularId(char **strs, int strCnt, char *outBuf, int outBufLen) { // } int main(void) { int n; if (scanf_s("%d\n", &n) != 1) { return -1; } static char buf[MAXN][BUF_LEN]; static char *input[MAXN]; int i; for (i=0; i<n; i++) { if (NULL == gets_s(buf[i], sizeof(buf[i]))) {return -1; } input[i] = buf[i]; } static char outBuf[MAXN * BUF_LEN]; RecularId(input, n, outBuf, sizeof(outBuf)); (void)printf("%s", outBuf); return 0; }