3.09 复试学习

📅 发布时间:2026/7/12 5:09:46 👁️ 浏览次数:
3.09 复试学习
oj125 回文镜面#include iostream #include bits/stdc.h using namespace std; //镜面表 char mirror[256]{0}; void initMirror(){ mirror[A]A;mirror[M]Y;mirror[Y]Y; mirror[E]3;mirror[O]O;mirror[Z]5; mirror[H]H;mirror[S]2;mirror[1]1; mirror[I]I;mirror[T]T;mirror[2]S; mirror[J]L;mirror[U]U;mirror[3]E; mirror[L]J;mirror[V]V;mirror[5]Z; mirror[W]W;mirror[X]X;mirror[8]8; } //判断是否回文 bool isHuiwen(const string s){ int ns.size(); for(int i0;in/2;i){ if(s[i]!s[n-1-i]){ return false; } } return true; } //判断是否镜面 bool isMirror(const string s){ int ns.size(); for(int i0;in;i){ char cs[i]; char excs[n-1-i]; if(mirror[c]0){ return false; } if(mirror[c]!exc){ return false; } } return true; } int main() { initMirror();//直接调入就行 string s; while(cins){ bool huiwenisHuiwen(s); bool mirrisMirror(s); if(!huiwen!mirr){ couts -- is not a palindrome.endl; }else if(huiwen!mirr){ couts -- is a regular palindrome.endl; }else if(!huiwenmirr){ couts -- is a mirrored string.endl; }else if(huiwenmirr){ couts -- is a mirrored palindrome.endl; } coutendl; } return 0; }利用数组结合ASCII构建对应数组。在main里直接调用init函数就好。回文的判断和镜面的判断都可以用一维数组对应位置去判断就好了。不修改的可以用const string s一般情况下用string s就足够了。oj126 数列2可以不连续-枚举子集#include iostream using namespace std; int main() { int n; while (cin n) { int a[15]; for (int i 0; i n; i) { cin a[i]; } int count 0; // 枚举所有非空子集 (mask 从 1 到 2^n - 1) for (int mask 1; mask (1 n); mask) { int sum 0; for (int i 0; i n; i) { if (mask (1 i)) { // 检查第i位是否选中 sum a[i]; } } if (sum % 11 0) { count; } } cout count endl; } return 0; }oj111 统计选票#include iostream #include string #include cctype #include algorithm using namespace std; struct candidate { string name; int result; }; // 自定义排序规则 bool compareCandidates(const candidate a, const candidate b) { if (a.result ! b.result) { return a.result b.result; // 票数多的在前 } return a.name b.name; // 票数相同 } int main() { candidate H[3]; H[0] {zhang, 0}; H[1] {li, 0}; H[2] {wang, 0}; int wrong_count 0; for (int i 0; i 10; i) { string s; cin s; // 转小写 for (size_t j 0; j s.length(); j) { s[j] tolower((unsigned char)s[j]); } if (s zhang) { H[0].result; } else if (s li) { H[1].result; } else if (s wang) { H[2].result; } else { wrong_count; } } // 排序 sort(H, H 3, compareCandidates); // 输出排序后的结果 for (int i 0; i 3; i) { cout H[i].name : H[i].result endl; } // 输出废票 cout Wrong election: wrong_count endl; return 0; }数组 记得初始化观察输入情况记得全转为大写/小写要利用数组一位一位转注意数组要如何用sortoj63 哥德巴赫素数判断按题目要求找出关系等式即可。#include iostream #include bits/stdc.h using namespace std; //素数判断 bool isSushu(int n){ if(n2) return false; for(int i2;isqrt(n);i){ if(n%i0){ return false; } } return true; } int main() { int n; while(n--){ int a; cina; //找 for(int p2;pa/2;p){ int qa-p; if(isSushu(p)isSushu(q)){ coutp qendl; break;//找到立马停 换 } } } return 0; }oj78 方块转换找好对应关系#include iostream #include vector using namespace std; // 比较两个矩阵是否相等 bool equal(const vectorstring a, const vectorstring b) { return a b; } // 顺时针旋转90度 vectorstring rotate90(const vectorstring grid) { int n grid.size(); vectorstring res(n, string(n, )); for (int i 0; i n; i) { for (int j 0; j n; j) { res[i][j] grid[n - 1 - j][i]; } } return res; } // 水平翻转左右镜像 vectorstring flipHorizontal(const vectorstring grid) { int n grid.size(); vectorstring res grid; for (int i 0; i n; i) { for (int j 0; j n / 2; j) { swap(res[i][j], res[i][n - 1 - j]); } } return res; } int main() { int n; cin n; vectorstring original(n); for (int i 0; i n; i) { cin original[i]; } vectorstring target(n); for (int i 0; i n; i) { cin target[i]; } // 尝试所有变换按优先级顺序 vectorstring current; // #1: 90度 current rotate90(original); if (equal(current, target)) { cout 1 endl; return 0; } // #2: 180度 current rotate90(current); // 9090180 if (equal(current, target)) { cout 2 endl; return 0; } // #3: 270度 current rotate90(current); // 18090270 if (equal(current, target)) { cout 3 endl; return 0; } // #4: 水平翻转 vectorstring flipped flipHorizontal(original); if (equal(flipped, target)) { cout 4 endl; return 0; } // #5: 翻转 旋转90, 180, 270 current rotate90(flipped); if (equal(current, target)) { cout 5 endl; return 0; } current rotate90(current); if (equal(current, target)) { cout 5 endl; return 0; } current rotate90(current); if (equal(current, target)) { cout 5 endl; return 0; } // #6: 不变 if (equal(original, target)) { cout 6 endl; return 0; } // #7: 无效 cout 7 endl; return 0; }oj71 发牌#include iostream #include vector using namespace std; // 比较两个矩阵是否相等 bool equal(const vectorstring a, const vectorstring b) { return a b; } // 顺时针旋转90度 vectorstring rotate90(const vectorstring grid) { int n grid.size(); vectorstring res(n, string(n, )); for (int i 0; i n; i) { for (int j 0; j n; j) { res[i][j] grid[n - 1 - j][i]; } } return res; } // 水平翻转左右镜像 vectorstring flipHorizontal(const vectorstring grid) { int n grid.size(); vectorstring res grid; for (int i 0; i n; i) { for (int j 0; j n / 2; j) { swap(res[i][j], res[i][n - 1 - j]); } } return res; } int main() { int n; cin n; vectorstring original(n); for (int i 0; i n; i) { cin original[i]; } vectorstring target(n); for (int i 0; i n; i) { cin target[i]; } // 尝试所有变换按优先级顺序 vectorstring current; // #1: 90度 current rotate90(original); if (equal(current, target)) { cout 1 endl; return 0; } // #2: 180度 current rotate90(current); // 9090180 if (equal(current, target)) { cout 2 endl; return 0; } // #3: 270度 current rotate90(current); // 18090270 if (equal(current, target)) { cout 3 endl; return 0; } // #4: 水平翻转 vectorstring flipped flipHorizontal(original); if (equal(flipped, target)) { cout 4 endl; return 0; } // #5: 翻转 旋转90, 180, 270 current rotate90(flipped); if (equal(current, target)) { cout 5 endl; return 0; } current rotate90(current); if (equal(current, target)) { cout 5 endl; return 0; } current rotate90(current); if (equal(current, target)) { cout 5 endl; return 0; } // #6: 不变 if (equal(original, target)) { cout 6 endl; return 0; } // #7: 无效 cout 7 endl; return 0; }翻译With the increasing popularity of smart wearable devices, such as earbuds and smart watches, presents new challenges for seamless and secure user authentication due to their limited user interfaces. Conventional biometric methods, including voice, fingerprints, and facial recognition often face issues such as usability limitations, interference from noise, or vulnerability to spoofing attacks. This paper introduces a novel authentication system called BaroAuth, which utilizes the stable and unique Speech-aware Pressure Sequences (SPSs) patterns captured by a miniaturized MEMS barometer embedded in earbuds. The design of BaroAuth hinges on two important observations. First, the production of speech relies on the coordinated movements of articulatory organs, including the tongue, jaw, and soft palate. These organs, through the activity of the temporomandibular joint (TMJ), alter the shape of the ear canal, thereby causing subtle pressure changes that encode the speakers unique physiological characteristics and articulatory dynamics. Second, SPSs show significant intra-individual consistency and considerable inter-individual variability, which barometers can effectively measure. Meanwhile, we develop the BaroAuth prototype and carry out comprehensive experiments based on it. The experimental findings reveal that BaroAuth demonstrates a mean false-acceptance rate (FAR) of 0.41% and a false-rejection rate (FRR) of 1.23%, respectively, even under complex attack scenarios.随着智能可穿戴设备如耳机和智能手表的日益普及由于其用户交互界面受限如何实现无缝且安全的用户认证成为了新的挑战。传统的生物识别方法包括语音、指纹和面部识别往往面临可用性受限、噪声干扰或易受欺骗攻击等问题。本文提出了一种名为BaroAuth的新型认证系统该系统利用嵌入在耳机中的微型 MEMS 气压计所捕获的稳定且独特的“语音感知压力序列”SPSs模式。BaroAuth 的设计基于两个重要观察首先语音的产生依赖于发音器官包括舌头、下颚和软腭的协调运动。这些器官通过颞下颌关节TMJ的活动改变耳道的形状从而引起细微的压力变化这些变化编码了说话者独特的生理特征和发音动态。其次SPSs 表现出显著的个体内一致性和相当大的个体间差异性而气压计能够有效地测量这些特征。与此同时我们开发了 BaroAuth 原型并进行了全面的实验。实验结果表明即使在复杂的攻击场景下BaroAuth 的平均误识率FAR仅为 0.41%拒真率FRR为 1.23%。基于深度学习的智能软件的可靠性已成为软件测试领域的一个关键挑战。本文首先概述了智能软件测试的核心概念并从三个维度——数据、模型即算法和平台即框架——系统分析了削弱可靠性的主要不确定性来源。随后文章识别出可靠性测试中的主要挑战重点聚焦于测试用例生成、测试方法论以及评估标准。接着总结了相关技术的最新进展。最后提出了未来有前景的研究方向旨在为推动可靠深度学习软件的发展提供新的见解。