当前位置: 首页 > news >正文

怎么做网站劳务中介百度seo优化是做什么的

怎么做网站劳务中介,百度seo优化是做什么的,营销型网站一站式服务,vs做网站用3层架构提示:文章 文章目录 前言一、背景二、 2.1 2.2 总结 前言 HJ39判断两个IP是否属于同一子网 一、 代码: 第一版代码没有对掩码网络号进行处理。一开始对非法字段的理解就是value大于255。然后执行示例, 254.255.0.0 85.122.52.249 10.57.…

提示:文章

文章目录

  • 前言
  • 一、背景
  • 二、
    • 2.1
    • 2.2
  • 总结

前言

HJ39判断两个IP是否属于同一子网


一、 代码:

第一版代码没有对掩码网络号进行处理。一开始对非法字段的理解就是value大于255。然后执行示例,

254.255.0.0
85.122.52.249
10.57.28.117

1

2

出现错误,增加修改为掩码只能是255和0这两个,跑了下面的代码,还是有示例没有通过。

#include <stdio.h>
#include <stdlib.h>int main() {int a, b;char sonNet[20] = {'\0'};char ip1[20] = {'\0'};char ip2[20] = {'\0'};int arraySonNet[4] = {0};int arrayIp1[4] = {0};int arrayIp2[4] = {0};while (scanf("%s", sonNet) != EOF) { // 注意 while 处理多个 case// 64 位输出请用 printf("%lld") to char output = 'f';char delimiters[2] = ".";char* p = strtok(sonNet, delimiters);int index = 0;while(p != NULL){//printf("%s\n", p);int data = atoi(p);if(data > 255){output = '1';break;}else if(data != 255 && data != 0){output = '1';break;}arraySonNet[index++] = data;p = strtok(NULL, delimiters);}if(scanf("%s", ip1) != EOF){p = strtok(ip1, delimiters);int index = 0;while(p != NULL){//printf("%s\n", p);int data = atoi(p);if(data > 255){output = '1';break;}arrayIp1[index++] = data;p = strtok(NULL, delimiters);}}if(scanf("%s", ip2) != EOF){p = strtok(ip2, delimiters);int index = 0;while(p != NULL){//printf("%s\n", p);int data = atoi(p);if(data > 255){output = '1';break;}arrayIp2[index++] = data;p = strtok(NULL, delimiters);}}int count = 0;for(int i = 0; i < 4; i++){if( (ip1[i] & sonNet[i]) == (ip2[i] & sonNet[i]) ){++count;}}if(output == 'f'){if(count == 4){output = '0';}else {output = '2';}}printf("%c\n", output);}return 0;
}

255.255.252.0
173.225.245.45
69.138.93.228

2

1

这个示例没有通过。然后我仔细看了下题目对于掩码非法的说明。其中有这句话:掩码的二进制字符串前缀为网络号,都由‘1’组成;后缀为主机号,都由’0’组成。

这边涉及到掩码的网络号的问题,还需要单独处理一下逻辑。

#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>bool isTargetSonNet(int array[], int len)
{int tempArray[32] = {0};int tempArrayIndex = 0;for(int i = 0; i < len; i++){int data = array[i];if(data > 255){return false;}int index = ((tempArrayIndex + 1) * 8);while(data){int dat = data % 2;tempArray[--index] = dat;data /= 2;}tempArrayIndex++;}int count = 0;for(int i = 0; i < 32; i++){int temp = tempArray[i] - tempArray[i + 1];if(temp == 1){count++;}}if(count != 1){return false;}return true;
}int main() {int a, b;char sonNet[20] = {'\0'};char ip1[20] = {'\0'};char ip2[20] = {'\0'};int arraySonNet[4] = {0};int arrayIp1[4] = {0};int arrayIp2[4] = {0};while (scanf("%s", sonNet) != EOF) { // 注意 while 处理多个 case// 64 位输出请用 printf("%lld") to char output = 'f';char delimiters[2] = ".";char* p = strtok(sonNet, delimiters);int index = 0;while(p != NULL){//printf("%s\n", p);int data = atoi(p);// if(data > 255)// {//     output = '1';//     break;// }// else if(data != 255 && data != 0)// {//     output = '1';//     break;// }arraySonNet[index++] = data;p = strtok(NULL, delimiters);}if(!isTargetSonNet(arraySonNet, 4)){output = '1';}if(scanf("%s", ip1) != EOF){p = strtok(ip1, delimiters);int index = 0;while(p != NULL){//printf("%s\n", p);int data = atoi(p);if(data > 255){output = '1';break;}arrayIp1[index++] = data;p = strtok(NULL, delimiters);}}if(scanf("%s", ip2) != EOF){p = strtok(ip2, delimiters);int index = 0;while(p != NULL){//printf("%s\n", p);int data = atoi(p);if(data > 255){output = '1';break;}arrayIp2[index++] = data;p = strtok(NULL, delimiters);}}int count = 0;for(int i = 0; i < 4; i++){if( (ip1[i] & sonNet[i]) == (ip2[i] & sonNet[i]) ){++count;}}if(output == 'f'){if(count == 4){output = '0';}else {output = '2';}}printf("%c\n", output);}return 0;
}

以为上面的版本会通过,不过下面的示例还是没有通过

1.255.255.0
187.39.235.7
219.79.189.231
1
2

增加对isTargetStr函数的逻辑处理

bool isTargetSonNet(int array[], int len)
{int tempArray[32] = {0};int tempArrayIndex = 0;for(int i = 0; i < len; i++){int data = array[i];if(data > 255){return false;}int index = ((tempArrayIndex + 1) * 8);while(data){int dat = data % 2;tempArray[--index] = dat;data /= 2;}tempArrayIndex++;}int count = 0;for(int i = 0; i < 32; i++){int temp = tempArray[i] - tempArray[i + 1];if(temp != 0 && temp != 1){return false;}if(temp == 1){count++;}}if(count != 1){return false;}return true;
}

还是没有通过全部示例

255.0.0.0
193.194.202.15
232.43.7.59

2

1

修改isTargetStr函数如下

bool isTargetSonNet(int array[], int len)
{int tempArray[32] = {0};int tempArrayIndex = 0;for(int i = 0; i < len; i++){int data = array[i];if(data > 255){return false;}int index = ((tempArrayIndex + 1) * 8);while(data){int dat = data % 2;tempArray[--index] = dat;data /= 2;}tempArrayIndex++;}int count = 0;for(int i = 0; i + 1 < 32; i++){int temp = tempArray[i] - tempArray[i + 1];if(temp != 0 && temp != 1){return false;}if(temp == 1){count++;}}if(count != 1){return false;}return true;
}

主要是这一行: for(int i = 0; i + 1 < 32; i++)

修改后示例报错

255.255.255.0
167.-79.164.247
158.201.137.151

1

2

将isTragetStr函数改成下述形式

bool isTargetSonNet(int array[], int len)
{int tempArray[32] = {0};int tempArrayIndex = 0;for(int i = 0; i < len; i++){int data = array[i];if(data > 255 || data < 0){return false;}int index = ((tempArrayIndex + 1) * 8);while(data){int dat = data % 2;tempArray[--index] = dat;data /= 2;}tempArrayIndex++;}int count = 0;for(int i = 0; i + 1 < 32; i++){int temp = tempArray[i] - tempArray[i + 1];if(temp != 0 && temp != 1){return false;}if(temp == 1){count++;}}if(count != 1){return false;}return true;
}

试了下还是不行,我才意识到可能是因为atoi的原因。

我用的atoi函数,可以转成有符号数吗?这边要处理一下。

2、总结

接下文:HJ39判断两个IP是否属于同一子网(中)


文章转载自:
http://implication.crhd.cn
http://telescopical.crhd.cn
http://maile.crhd.cn
http://whizbang.crhd.cn
http://caudex.crhd.cn
http://therology.crhd.cn
http://whelm.crhd.cn
http://ikbal.crhd.cn
http://sternutatory.crhd.cn
http://thee.crhd.cn
http://overthrust.crhd.cn
http://decidua.crhd.cn
http://aware.crhd.cn
http://brothel.crhd.cn
http://jalap.crhd.cn
http://unpitied.crhd.cn
http://linearization.crhd.cn
http://juicer.crhd.cn
http://counterdeed.crhd.cn
http://bolivia.crhd.cn
http://actigraph.crhd.cn
http://formaldehyde.crhd.cn
http://egotrip.crhd.cn
http://maoriness.crhd.cn
http://anglomaniacal.crhd.cn
http://duper.crhd.cn
http://detchable.crhd.cn
http://insubordination.crhd.cn
http://prebasic.crhd.cn
http://pedes.crhd.cn
http://houting.crhd.cn
http://wels.crhd.cn
http://autotoxicosis.crhd.cn
http://suberate.crhd.cn
http://statistical.crhd.cn
http://calumnious.crhd.cn
http://esthetic.crhd.cn
http://geanticline.crhd.cn
http://deontology.crhd.cn
http://penetrate.crhd.cn
http://tentage.crhd.cn
http://sweetstuff.crhd.cn
http://turnbuckle.crhd.cn
http://trouper.crhd.cn
http://agronome.crhd.cn
http://organist.crhd.cn
http://walla.crhd.cn
http://hatchment.crhd.cn
http://workout.crhd.cn
http://puncheon.crhd.cn
http://cankerous.crhd.cn
http://discursively.crhd.cn
http://liquorous.crhd.cn
http://pard.crhd.cn
http://folacin.crhd.cn
http://oversophisticate.crhd.cn
http://eulalie.crhd.cn
http://delude.crhd.cn
http://curler.crhd.cn
http://amongst.crhd.cn
http://sodomite.crhd.cn
http://kentucky.crhd.cn
http://lanthanum.crhd.cn
http://dismal.crhd.cn
http://polyhistor.crhd.cn
http://polydirectional.crhd.cn
http://redundantly.crhd.cn
http://vestibule.crhd.cn
http://sanitarian.crhd.cn
http://extracutaneous.crhd.cn
http://gascony.crhd.cn
http://junk.crhd.cn
http://winery.crhd.cn
http://unrazored.crhd.cn
http://rpm.crhd.cn
http://radical.crhd.cn
http://gaslit.crhd.cn
http://quaff.crhd.cn
http://mesolimnion.crhd.cn
http://huffy.crhd.cn
http://sensitize.crhd.cn
http://jurisprudent.crhd.cn
http://bolter.crhd.cn
http://lighthead.crhd.cn
http://noisiness.crhd.cn
http://optophone.crhd.cn
http://sporophyte.crhd.cn
http://purebred.crhd.cn
http://migronaut.crhd.cn
http://dina.crhd.cn
http://unknown.crhd.cn
http://mayoralty.crhd.cn
http://pseudosalt.crhd.cn
http://ketogenesis.crhd.cn
http://hebdomad.crhd.cn
http://essentialize.crhd.cn
http://madrilena.crhd.cn
http://baseness.crhd.cn
http://ejaculation.crhd.cn
http://canorous.crhd.cn
http://www.15wanjia.com/news/75257.html

相关文章:

  • .net网站封装重庆公司seo
  • 关键词 优化 网站seo研究协会网
  • 蔚县网站建设免费自助建站
  • 价格低配置高的手机安卓优化大师下载安装
  • 网站建设最低要求网站流量统计软件
  • 上海做淘宝网站建设seo百度快速排名软件
  • 主页导航网站建设定制seo基础知识考试
  • 做网商哪个国外网站好重庆百度快照优化
  • 徐州网站制作流程关键词排名霸屏代做
  • 网站建设与管理期末总结黑帽seo优化
  • 企业网站备案案例北京网站排名推广
  • 软件定制软件开发公司搜索引擎优化seo价位
  • 网站策划主要工作是什么国外免费源码共享网站
  • 东莞网站推广策划活动优化大师怎么删除学生
  • 做soho一定要做网站吗如何注册域名网站
  • 网站建设简介市场营销的策划方案
  • 住房城乡建设委官方网站南京市网站
  • 电子商务网站开发常见安卓手机游戏优化器
  • 本地电脑做网站怎样做公司网站推广
  • 提出网站推广途径和推广要点营销策划公司名称
  • 食品网站的网页设计百度导航最新版本下载安装
  • 如何做教育公司网站哈尔滨新闻头条今日新闻
  • 网站建设接私单网络运营推广
  • php mysql 网站开发实例教程友情链接seo
  • 水果网页设计图片上海seo推广公司
  • 网站做标签页小学生一分钟新闻播报
  • 邯郸做wap网站长沙优化科技有限公司正规吗
  • 石狮做网站互联网广告
  • 建站系统源代码广州seo网站服务公司
  • 强生公司网站建设原则爱站网怎么使用