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

当前网站开发什么语言右面是某网站建设立项需求

当前网站开发什么语言,右面是某网站建设立项需求,vi设计网站排行榜,网站建设与运营公司财务预算文章目录 蓝桥杯日期统计特殊日期(位数之和)2023特殊日期(倍数)跑步锻炼 蓝桥杯 日期统计 日期统计 如果暴力枚举100个数的八次循环那就是1016次运算,时间复杂度太高了,好在前四次的2023是确定的&#xf…

文章目录

  • 蓝桥杯
    • 日期统计
    • 特殊日期(位数之和)
    • 2023
    • 特殊日期(倍数)
    • 跑步锻炼

蓝桥杯

日期统计

日期统计

在这里插入图片描述

  如果暴力枚举100个数的八次循环那就是1016次运算,时间复杂度太高了,好在前四次的2023是确定的,所以我们优化一下,前四次循环不等于2023的就直接进入下一个循环,现在只需要108次运算了,注意有不少日子是重复的,所以还需要我们使用set去重一下。

  也可以不使用set,我们之间对2023年的365天遍历,如果数组中有满足2023年日期范围的数我们直接++,这样不仅减少了循环的次数(一共需要大概365*100=36500次循环),也避免了去重。

#include<bits/stdc++.h>
using namespace std;#if 0
int main()
{int arr[100] = {5, 6, 8, 6, 9, 1, 6, 1, 2, 4, 9, 1, 9, 8, 2, 3, 6, 4, 7, 7,5, 9, 5, 0, 3, 8, 7, 5, 8, 1, 5, 8, 6, 1, 8, 3, 0, 3, 7, 9,2, 7, 0, 5, 8, 8, 5, 7, 0, 9, 9, 1, 9, 4, 4, 6, 8, 6, 3, 3,8, 5, 1, 6, 3, 4, 6, 7, 0, 7, 8, 2, 7, 6, 8, 9, 5, 6, 5, 6,1, 4, 0, 1, 0, 0, 9, 4, 8, 0, 9, 1, 2, 8, 5, 0, 2, 5, 3, 3};int months[13] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};set<int> ret;for(int i=0;i<100;i++){if(arr[i]!=2) continue;for(int j=i+1;j<100;j++){if(arr[j]!=0) continue;for(int k=j+1;k<100;k++){if(arr[k]!=2) continue;for(int l=k+1;l<100;l++){if(arr[l]!=3) continue;for(int a=l+1;a<100;a++){for(int b=a+1;b<100;b++){for(int c=b+1;c<100;c++){for(int d=c+1;d<100;d++){int date=arr[a]*1000+arr[b]*100+arr[c]*10+arr[d];int month=arr[a]*10+arr[b];int day=arr[c]*10+arr[d];if(month>=1&&month<=12&&day>=1&&day<=months[month]){ret.insert(date);//cout<<date<<endl;}}}}}}}}}cout<<ret.size()<<endl;return 0;
}
#endif #if 1
int main() 
{int arr[100] = {5, 6, 8, 6, 9, 1, 6, 1, 2, 4, 9, 1, 9, 8, 2, 3, 6, 4, 7, 7,5, 9, 5, 0, 3, 8, 7, 5, 8, 1, 5, 8, 6, 1, 8, 3, 0, 3, 7, 9,2, 7, 0, 5, 8, 8, 5, 7, 0, 9, 9, 1, 9, 4, 4, 6, 8, 6, 3, 3,8, 5, 1, 6, 3, 4, 6, 7, 0, 7, 8, 2, 7, 6, 8, 9, 5, 6, 5, 6,1, 4, 0, 1, 0, 0, 9, 4, 8, 0, 9, 1, 2, 8, 5, 0, 2, 5, 3, 3};int months[13] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};int ret = 0;for (int month=1;month<=12;month++){for(int day=1;day<months[12];day++){int target[8]={2,0,2,3,month/10,month%10,day/10,day%10};int count=0;for(int i=0;i<100;i++){if(arr[i]==target[count]){count++;}if(count==8){ret++;break;}}}}cout<<ret<<endl;return 0;
}
#endif 

  

特殊日期(位数之和)

特殊日期

在这里插入图片描述
  我们根据题意直接暴力即可,注意一下闰年的判断year%400==0||(year%4==0&&year%100!=0) 继续将年份的数字之和和月份天数的日子和做比较。

#include<bits/stdc++.h>
using namespace std;int months[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};void is_gap_month(int year,int month)
{if(month==2&&year%400==0||(year%4==0&&year%100!=0))months[2]=29;else months[2]=28;
}int is_target(int year,int month,int day)
{int sum1=0,sum2=0;while(year){int cnt=year%10;sum1+=cnt;year/=10;}sum2=month/10+month%10+day/10+day%10;return sum1==sum2?1:0;
}int main()
{int ret=0;for(int year=1900;year<=9999;year++){for(int month=1;month<=12;month++){is_gap_month(year,month);for(int day=1;day<=months[month];day++){if(is_target(year,month,day)){ret++;}}}}cout<<ret<<endl;return 0;
}

  

2023

2023

在这里插入图片描述
  将每一个数从后向前依次取下末尾的数字,依次和3 2 0 2进行比较,如果这个数中完全包含2023,ret++。最后将所有的数减去完全包含的数,剩下的就是完全不包含的数,注意这里 98765432 - 12345678 之后还要加一。

#include <iostream>
using namespace std;int is_target(int n)
{while (n){int tmp1 = n % 10;n /= 10;if (tmp1 == 3){while (n){int tmp2 = n % 10;n /= 10;if (tmp2 == 2){while (n){int tmp3 = n % 10;n /= 10;if (tmp3 == 0){while (n){int tmp4 = n % 10;n /= 10;if(tmp4 == 2)return 1;}}}}}}}return 0;
}int main()
{int ret = 0;for (int i = 12345678; i <= 98765432; i++){if (is_target(i)){//cout<<i<<endl;ret++;}}cout << 98765432 - 12345678 - ret+1;//cout<<"85959030";return 0;
}

  

特殊日期(倍数)

特殊日期
在这里插入图片描述

#include <iostream>
using namespace std;int main()
{int ret=0;int months[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};for(int year=2000;year<=2000000;year++){for(int month=1;month<=12;month++){if(year%month==0){if(month==2&&(year%400==0||(year%4==0&&year%100!=0))){months[2]=29;}else{months[2]=28;}for(int day=1;day<=months[month];day++){if(year%day==0){ret++;}if(year==2000000&&month==1&&day==1){cout<<ret<<endl;}}}}}//cout<<"35813063"<<endl;return 0;
}

  

跑步锻炼

跑步锻炼

在这里插入图片描述

#include <iostream>
using namespace std;int is_gap_year(int n)
{if((n%400==0)||(n%4==0&&n%100!=0))return 1;else return 0;
}int main()
{int ret=0;int months[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};int year=0,month=0,day=0;int week=6;for(int i=2000;i<=2020;i++){for(int j=1;j<=12;j++){if(j==2&&is_gap_year(i)) months[2]=29;else months[2]=28;for(int k=1;k<=months[j];k++){if(week==8){ week=1;}if(week==1||k==1) {ret+=2;}else{ ret+=1;}week++;if(i==2020&&j==10&&k==1)cout<<ret;}}}return 0;
}
http://www.yayakq.cn/news/381051/

相关文章:

  • 江苏建站速度忿花店网页制作素材
  • 免费个人网站域名注册公益404 wordpress
  • 有服务器和域名怎么做网站网站建设综合训练的实验目的
  • 百度免费推广登录入口西安网站排名优化
  • 网站建设运行维护合同上海网站域名备案处
  • confluence和wordpress2022年seo最新优化策略
  • appcan 手机网站开发新余哪有做网站的公司
  • 网站seo关键词优化排名网站开发语言有那些
  • 相册特效手机网站服务型网站有哪些
  • 惠州seo博客北京债务优化公司
  • 企业网站建设经验宁国市网站建设
  • 小米网站制作做个网站需要什么
  • 如何注册免费网站域名百度小程序优化排名
  • 义乌网站建设优化案例网站模板修改
  • 湘潭做网站 用户多磐石网络上海学校网站建设
  • 网站网站做庄是怎样做电子商城网站开发教程
  • 论坛打赏网站开发淘宝优惠的网站怎么做
  • 想在网上做开发网站接活儿杭州做公司官网的公司
  • 广东企业网站seo报价wordpress网速卡
  • wordpress用户标签广州网站优化排名系统
  • 上海网站关键词优化方法南通做网站价格
  • 网站域名如何更换网站如何设置404页面
  • 网站开发的英文参考文献word模板免费网站
  • 沙漠风网站建设怎么样asp网站开发心得体会
  • 昌吉网站建设咨询电话如何做商业网站推广
  • 南昌网站建设加王道下拉做新媒体每天必看的网站
  • 网页制作教程网站专业建站公司报价单
  • 郑州营销型网站制作运营百度知道网页版入口
  • 网站建设业务的延伸性科技有限公司是什么性质
  • 松江网站开发公司ftp工具下载网站源码教程