首页
DreamJudge
院校信息
专业题库
模拟考试
机试真题
408真题
专业课程
兑换中心
登录
注册
上岸
以下题解仅供学习参考使用。
抄袭、复制题解,以达到刷AC率/AC数量或其他目的的行为,在N诺是严格禁止的。
N诺非常重视学术诚信。此类行为将会导致您成为作弊者。具体细则请查看N诺社区规则。
carrot_huan
2025年3月18日 19:13
IP地址 题解:重新做了一遍,有三个关键点,求16进制,判断合法,输出
P1023
回复 0
|
赞 3
|
浏览 494
#include<algorithm> #include<vector> #include<iostream> #include<string> #include<cstdio> using namespace std; string stander = "0123456789ABCDEF"; bool Judge(string str) { for (char i : str) &n...
zxjrheaven
2025年3月14日 14:49
IP地址 题解:暴力
P1023
回复 0
|
赞 3
|
浏览 274
#include <bits/stdc++.h> using namespace std; void shuchu(int a) { if(a>=0&&a<=9) { char zm1='0'+a; cout<<zm1; } ...
孙某人
2024年2月23日 18:38
IP地址 题解:新手易懂方法+易错总结
P1023
回复 1
|
赞 27
|
浏览 1.5k
一开始不知道ip地址什么意思,看了个题解的解释以及易错点,一遍过的。 因为水平比较菜代码看着多,好多都基本一样复制粘贴加改一点的 思路: 1.合法的ip地址就是 数字1.数字2.数字3.数字4 数字的范围是0-255,其他都不对 2.这里用 4个大的嵌套if else,数字输入后要用一个数记录其位数(如果是三位的要判断大小 小于256),用四个数记录这四个数字 3.之后根据得到的位数判断下一个字符是不是'.',&nbs...
xddddddddddddd
2025年3月12日 19:34
IP地址 题解:C++最易理解代码
P1023
回复 0
|
赞 2
|
浏览 207
#include<iostream> #include<string> #include<algorithm> using namespace std; //从合法字符串转为整数 int getNumber(string s){ int num=0; for(char c:s){ num=num*10+(c-'0'); &nbs...
GENARDING
2025年3月10日 16:19
IP地址 题解:注意0.0.0.0这个地址,80%过不了,找好久
P1023
回复 0
|
赞 5
|
浏览 293
#include <bits/stdc++.h> using namespace std; // 将十进制的字符串转换为十六进制字符串 string convert(string s) { int res = 0; for (int i = 0; i < s.size(); i++) { res = res * 10 + (s[i] - '0'); } if (res == 0) { return "0"; } string result = ""; ...
AiLanKeSi
2025年3月5日 01:55
IP地址 题解:记录点的个数,使用atoi函数将各位转整数
P1023
回复 0
|
赞 2
|
浏览 338
#include <iostream> #include <cstdlib> #include <string.h> using namespace std; int main() { char str[1000]; char str_1[1000]; char str_2[1000]; char str_3[1000]; char str_4[...
小刘啊
2025年3月2日 20:14
IP地址 题解:纯暴力
P1023
回复 0
|
赞 7
|
浏览 388
#include <iostream> #include <string> using namespace std; string f(int a) //返回一个string类型的16进制数 { string s, res; while(a) { int temp = a % 16; if(temp < 10) s += ('0...
V_v_longlong
2024年3月29日 21:40
IP地址 题解:
P1023
回复 1
|
赞 12
|
浏览 1.1k
#include <stdio.h> #include <string.h> //获取点与点之间的地址值 int fun(char s[100],int i,int j){ int len=j-i,sum=0,t=1; while(len){ sum+=(s[j-1]-'0')*t; len--;  ...
yi ming
2020年10月19日 20:46
ip地址(C)
P1023
回复 6
|
赞 42
|
浏览 21.0k
#include<stdio.h> int main(void) { int a, b, c, d = 256; // 由于点分十进制要求四个数字均小于255 char ch; //所以设置d的初始值为256,便于后期判断输入是否合法 scanf("%d.%d.%d.%d", &a,&b,&c,&d); //对输入格式做限制,便于下面检测非法输入 if(a > 255 || b > 255 || c > 255 || d > 255 )// 判断a,b,c,d是否都...
Candour
2024年4月20日 00:29
IP地址 题解:
P1023
回复 0
|
赞 8
|
浏览 960
#include<bits/stdc++.h> using namespace std; char num[1010]; bool cheak(string str) //判断合法性 { int cnt = 0, sum = 0; for(int i = 0; i < str.size(); i ++) { if(sum > 255) return false; if((str[i] < '0' || str[i] > '9') && str[i] != '.') return false;...
1
2
3
题目
IP地址
题解数量
22
发布题解
在线答疑
热门题解
1
ip地址(C)
2
IP地址 题解:新手易懂方法+易错总结
3
IP地址 题解:
4
题解:IP地址
5
IP地址 题解:
6
IP地址 题解:纯暴力
7
IP地址 题解:判断点的个数以及每个位置是不是数字 且数字范围是不是正确
8
C++,我自己一步步通过遇到的错误,附加带注释的完整代码
9
IP地址 题解:注意0.0.0.0这个地址,80%过不了,找好久
10
IP地址