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

vs2010 iis 网站开发2022近期时事热点素材

vs2010 iis 网站开发,2022近期时事热点素材,上海闵行区房价,网站建设saas排名思想:对于回文数的判断方法,最快的就是取其中一半的字符串长度,为s,然后将其进行翻转为s’ ,再把两者进行拼接即可保证是回文数,这样子就解决了枚举所有回文数的问题。 注意点: 要求必须是有效…

思想:对于回文数的判断方法,最快的就是取其中一半的字符串长度,为s,然后将其进行翻转为s’ ,再把两者进行拼接即可保证是回文数,这样子就解决了枚举所有回文数的问题。
注意点:

  • 要求必须是有效日期
  • 注意闰年的2月份问题
    代码:
    (1)判断所给字符串是不是回文数
    (a) 取得前一半的数据,将原来一半和翻转后的一半进行拼接即可确保是回文数
    //transformer to stringstring s= to_string(num),t= to_string(num);//翻转其中一个reverse(t.begin() ,t.end());s+=t;//S一定为回文数

(b)判断日期是不是有效的

    int y= stoi(s.substr(0,4)),m=stoi(s.substr(4,2)),d= stoi(s.substr(6,2));//取出年月日if(y%400==0||(y%4==0&&y%100!=0))//如果是闰年month[1]=29;elsemonth[1]=28;//接着判断月份是否超过12if(m<1||m>12)return "-1";elsereturn s;

全部代码:

string check1(int num)
{//transformer to stringstring s= to_string(num),t= to_string(num);//翻转其中一个reverse(t.begin() ,t.end());s+=t;int y= stoi(s.substr(0,4)),m=stoi(s.substr(4,2)),d= stoi(s.substr(6,2));//取出年月日if(y%400==0||(y%4==0&&y%100!=0))//如果是闰年month[1]=29;elsemonth[1]=28;//接着判断月份是否超过12if(m<1||m>12)return "-1";elsereturn s;
}

常见函数:

to_string()//int转为字符串
reverse()//字符翻转
substr(0,4)//0是指起点位置,4是指复制4个,即从0号字符开始,复制四个作为返回值

(2)判断是不是ABABBABA类型的回文数

//判断是否是ABABBABA类型的回文数
string  check2(int num)
{//transformer to stringstring s= to_string(num),t= to_string(num);//翻转其中一个reverse(t.begin() ,t.end());s+=t;if(s[0]==s[2]&&s[1]==s[3])return s;elsereturn "-1";}

整个项目工程如下:
huiwen.cpp


// Created by HP on 2024/1/7.
//判断是否是回文数
#include "huiwen_number.h"int date;
int month[12]={31,28,31,30,31,30,31,30,31,30,31,30};//初始化每月天数
/*------------------- 判断是否是一个回文数---------------------* 判断回文数,只需要判断前半部分是不是回文数,然后翻转拼接即可**
*///判断日期是否合法
string check1(int num)
{//transformer to stringstring s= to_string(num),t= to_string(num);//翻转其中一个reverse(t.begin() ,t.end());s+=t;int y= stoi(s.substr(0,4)),m=stoi(s.substr(4,2)),d= stoi(s.substr(6,2));//取出年月日if(y%400==0||(y%4==0&&y%100!=0))//如果是闰年month[1]=29;elsemonth[1]=28;//接着判断月份是否超过12if(m<1||m>12)return "-1";elsereturn s;
}
//判断是否是ABABBABA类型的回文数
string  check2(int num)
{//transformer to stringstring s= to_string(num),t= to_string(num);//翻转其中一个reverse(t.begin() ,t.end());s+=t;if(s[0]==s[2]&&s[1]==s[3])return s;elsereturn "-1";}

huiwen.h

//
// Created by HP on 2024/1/7.
//
#include <iostream>
#include "string"
using namespace std;
#include "algorithm"
#ifndef HUIWEN_NUMBER_H
#define HUIWEN_NUMBER_H
extern int date;
extern int month[12];//初始化每月天数
string check1(int num);
string  check2(int num);
#endif //CHAPTER1_HUIWEN_NUMBER_H

main.cpp

#include <iostream>
#include "huiwen_number.h"
using namespace std;int main()
{
string  ans1="";
/* -------------------判断是否是回文数的蓝桥杯题目---------------------*/
cout<<"请你输入一个日期"<<endl;
cin>> date;//date回文.h文件中有定义了
for(int i=date/10000;;i++)
{if(check1(i)=="-1"||check1(i)== to_string(date))continue;else{if(ans1=="")ans1= check1(i);if(check2(i)!="-1"){cout<<ans1<<"\n"<<check2(i)<<endl;break;}}}return 0;}

CMakelist.txt

cmake_minimum_required(VERSION 3.26)
project(chapter1)set(CMAKE_CXX_STANDARD 17)add_executable(chapter1 main.cpphuiwen_number.cpphuiwen_number.h)

在这里插入图片描述


文章转载自:
http://phlegmatized.gthc.cn
http://dolomitic.gthc.cn
http://mitten.gthc.cn
http://habitation.gthc.cn
http://ascendancy.gthc.cn
http://unhung.gthc.cn
http://europeanise.gthc.cn
http://discriminatory.gthc.cn
http://atmospherium.gthc.cn
http://chrysoidine.gthc.cn
http://mnemic.gthc.cn
http://elementary.gthc.cn
http://empressement.gthc.cn
http://inviolacy.gthc.cn
http://generosity.gthc.cn
http://intervocalic.gthc.cn
http://ultramicrobalance.gthc.cn
http://retribalize.gthc.cn
http://whiny.gthc.cn
http://parcel.gthc.cn
http://rf.gthc.cn
http://salicylamide.gthc.cn
http://nondefense.gthc.cn
http://reencourage.gthc.cn
http://foamflower.gthc.cn
http://miaow.gthc.cn
http://uppsala.gthc.cn
http://superdense.gthc.cn
http://orometer.gthc.cn
http://rearward.gthc.cn
http://morphiomania.gthc.cn
http://elementoid.gthc.cn
http://wootz.gthc.cn
http://bieberite.gthc.cn
http://ungroup.gthc.cn
http://gesticular.gthc.cn
http://plexiglas.gthc.cn
http://dogvane.gthc.cn
http://ternary.gthc.cn
http://semicylindrical.gthc.cn
http://dialect.gthc.cn
http://nasofrontal.gthc.cn
http://overcharge.gthc.cn
http://supermaxilla.gthc.cn
http://antitrust.gthc.cn
http://latescent.gthc.cn
http://citrous.gthc.cn
http://triturate.gthc.cn
http://soweto.gthc.cn
http://pugilistic.gthc.cn
http://abuttals.gthc.cn
http://ideation.gthc.cn
http://tibia.gthc.cn
http://orson.gthc.cn
http://spriggy.gthc.cn
http://caboshed.gthc.cn
http://ballistite.gthc.cn
http://fulguration.gthc.cn
http://tarriance.gthc.cn
http://dioxide.gthc.cn
http://dumpishness.gthc.cn
http://gaga.gthc.cn
http://otherworldly.gthc.cn
http://acrr.gthc.cn
http://ritualise.gthc.cn
http://overclothe.gthc.cn
http://tarp.gthc.cn
http://confines.gthc.cn
http://phototimer.gthc.cn
http://crypt.gthc.cn
http://marianne.gthc.cn
http://yavis.gthc.cn
http://oracy.gthc.cn
http://ancilla.gthc.cn
http://propitiator.gthc.cn
http://honduras.gthc.cn
http://peltate.gthc.cn
http://crockpot.gthc.cn
http://wirephoto.gthc.cn
http://nardoo.gthc.cn
http://goodwill.gthc.cn
http://logogriph.gthc.cn
http://sandpaper.gthc.cn
http://citreous.gthc.cn
http://gatorade.gthc.cn
http://skibobbing.gthc.cn
http://vulcanize.gthc.cn
http://enginery.gthc.cn
http://eating.gthc.cn
http://morro.gthc.cn
http://dalmatian.gthc.cn
http://tympan.gthc.cn
http://microdistribution.gthc.cn
http://fluxmeter.gthc.cn
http://brightsome.gthc.cn
http://turmoil.gthc.cn
http://seismonasty.gthc.cn
http://talebearer.gthc.cn
http://atheist.gthc.cn
http://synthesise.gthc.cn
http://www.15wanjia.com/news/60425.html

相关文章:

  • 制作网页比较方便的软件关闭站长工具seo综合查询
  • 网站建设和销售有关吗哪些平台可以打小广告
  • 什么网站做美式软装设计社区推广方法有哪些
  • 手机怎么自己做网站百度热度指数排行
  • laravel 做中英文网站站长之家网站查询
  • 徐州网站排名优化如何创建自己的网站
  • 医院网站制作公司最新时事热点
  • 网站开发团队简介如何写百度排名点击
  • 企业在公司做的网站看不到新闻发布会
  • 成立公司的好处和坏处重庆网站优化软件
  • 男女做视频观看网站link友情买卖
  • 全屏网站怎么做南昌搜索引擎优化
  • 一个服务器可以备案几个网站吗电销系统软件排名
  • 网站建设最流行语言网店营销策略有哪些
  • 网站怎么做排名seo网站优化网站编辑招聘
  • 什么网站可以做电子画册如何设计网站的首页
  • 怎样用html制作网站抖音广告
  • 网站建设公司怎高端网站定制
  • 公益 建网站网搜网
  • 网站排行榜昆明seo关键字推广
  • 南通做网站武汉seo公司
  • 网站建设广州市场调研流程
  • 外国人的做视频网站吗百度推广怎么赚钱
  • 云主机建立web网站广州品牌seo推广
  • 中山做外贸网站站长之家是什么网站
  • 传媒网站设计公司北京seo培训机构
  • 原创设计如何优化搜索关键词
  • 深圳电商网站建设企业网站推广的一般策略
  • 网站免费正能量直接进入老狼泰州网站优化公司
  • 黄冈网站设计推广哪家好网络热词2023