链接那道题,为什么只通过了60%
function link() {
var content=$("#jsContainer").html();
var reg=/(http:\/\/|https:\/\/)((\w|=|\?|\.|\/|&|-) )/g;
var s=content.replace(reg,'<a href="$1$2" target="_blank">$1$2</a>'); $("#jsContainer").html(s); 第二题:C
#include <iostream>
#include <cstring>
#include <algorithm>
#include <cmath>
using namespace std;
const int maxn = 55;
char p[maxn];
int main()
{
cin >> p;
int res = 0;
int len = strlen(p);
for(int i = 0; i < len; i ) {
if(p[i] == ']') --res;
else if(p[i] == '[') {
res;
}
if(res < 0) {
for(int j = res; j < 0; j ) {
cout << "[";
}
res = 0;
}
}
for(int i = 0; i < len; i ) {
cout << p[i];
}
for(int i = 0; i < res; i ) {
cout << "]";
}
cout << endl;
return 0;
}
/**
][[[[[]]][][][]]
**/ #百度##前端工程师#
查看3道真题和解析
九号公司成长空间 1人发布