写一段程序判断IP字符串是否属于内网IP

题目
公司:哔哩哔哩
类型:模拟

#include <bits/stdc++.h>
using namespace std;

int main(){
	int a, b, c, d;
	scanf("%d.%d.%d.%d", &a, &b, &c, &d);
	if(a==10 ||(a==192 && b==168) ||(a==172&&(b>=16&&b<32))) puts("1");
	else puts("0");
	return 0;
} 
发布了1205 篇原创文章 · 获赞 54 · 访问量 9万+

猜你喜欢

转载自blog.csdn.net/SYaoJun/article/details/105129295