文章
34
粉丝
89
获赞
3
访问
20.5k
#include<bits/stdc++.h>
using namespace std;
string trans(int n){//10进制转16进制
string s = "";
int num = 2;
while(num--){
int w = n % 16;
if(w < 10){
s += (w + '0');
}else{
s += ((w - 10) + 'A');
}
n = n / 16;
}
reverse(s.begin(),s.end());
return s;
}
int string2Num(string str){
int num = 0;
int len = str.size();
for(int i = 0;i < len;i++){
int temp = str[i] - '0';
if(temp < 0 || temp > 9) return 256;
num *= 10;
num += temp;
}
return num;
}
bool Judge(string str){
int pointNum = 0;
int len = str.size();
int begin = 0;
for(int i = 0;i < len;i++){
if(str[i] == '.'){
pointNum++;
string temp = str.substr(begin,i - begin);
int num = string2Num(temp);
if(pointNum == 1){
if(num > 255 ) return false;
...
登录后发布评论
暂无评论,来抢沙发