第五题这样做不知道是不是很笨😣 #include<iostream> (5488)#include<string> #include<ctime> (16669)#include<vector> using namespace std; int main() { int l; cin >> l; srand(time(NULL)); int ba = (rand() % (10000 - 1000) + 1000); string b=to_string(ba); string c; for (int m = 0; m < l; m++) { cin >> c; int bb = 0; int dd = 0; vector<int> v; for (int a = 0; a < b.length(); a++) { if (b[a] == c[a]) { bb = bb + 1; } else if (b[a] != c[a]) { v.push_back(a); } } for (vector<int>::iterator it = v.begin(); it != v.end(); it++) { for (vector<int>::iterator its = v.begin(); its != v.end(); its++) { if (b[*it] == c[*(its)] &;&; it != its) { dd = dd + 1; } } } cout << "你对了" << bb << "个数字" << endl; cout << "其中你有" << dd << "在里面但是位置不对" << endl; } cout << "最终数字为" << b << endl; }

相关推荐

给我发了笔试链接,想着等晚上回去做,结果还没做流程就终止了
伟大的小黄鸭在学习:我猜就是笔试几乎没用,就是用来给用人部门拖时间复筛简历的,可能用人部门筛到你简历觉得不合适就提前挂了
投递小鹏汽车等公司10个岗位
点赞 评论 收藏
分享
06-12 16:23
已编辑
小米_软件开发
点赞 评论 收藏
分享
牛客网
牛客网在线编程
牛客网题解
牛客企业服务