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

丰台武汉阳网站建设竞价推广渠道

丰台武汉阳网站建设,竞价推广渠道,设计感网站,中国人才热线官网题目描述 题目分析 对于输入的abc我们可以以a为年也可以以c为年,将abc,cab,cba这三种情况进行判断合法性即可,注意需要排序去重,所以考虑使用set 此处为纯模拟的写法,但使用循环代码会更加简洁。 方法一: #include&…

题目描述

题目分析

对于输入的abc我们可以以a为年也可以以c为年,将abc,cab,cba这三种情况进行判断合法性即可,注意需要排序去重,所以考虑使用set

此处为纯模拟的写法,但使用循环代码会更加简洁。

方法一:

#include<bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10;
set<string> st;
string s[N];
int cnt;
int m[13] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
bool is_ren(int x)
{if((x % 4 == 0 && x % 100 != 0)||(x % 400 == 0))return true;return false;
}
int main()
{int a, b, c;scanf("%d/%d/%d",&a, &b, &c);//以a为年 //abcif(a <= 59){//abcif(b <= 12 && b > 0){int x = 2000 + a;if(is_ren(x))m[2] = 29;else m[2] = 28;if(c <= m[b] && c > 0){cnt ++;s[cnt] = "20";if(a < 10)s[cnt] += "0";s[cnt] += (to_string(a) + "-" );if(b < 10)s[cnt] += "0";s[cnt] += (to_string (b) + "-");if(c < 10)s[cnt] +="0";s[cnt] += to_string(c);st.insert(s[cnt]);}}}else if(a > 59){//abcif(b <= 12 && b > 0){int x = 1900 + a;if(is_ren(x))m[2] = 29;else m[2] = 28;if(c <= m[b] && c > 0){cnt ++;s[cnt] = "19";if(a < 10)s[cnt] += "0";s[cnt] += to_string(a) + "-" ;if(b < 10)s[cnt] += "0";s[cnt] += to_string (b) + "-";if(c < 10)s[cnt] +="0";s[cnt] += to_string(c);st.insert(s[cnt]);}}}//以c为年 //cab, cba if(c <= 59){//cabif(a <= 12 && a > 0){int x = 2000 + c;if(is_ren(x))m[2] = 29;else m[2] = 28;if(b <= m[a] && b > 0){s[++ cnt] = "20";if(c < 10)s[cnt] += "0";s[cnt] += to_string(c) + "-" ;if(a < 10)s[cnt] += "0";s[cnt] += to_string (a) + "-";if(b < 10)s[cnt] +="0";s[cnt] += to_string(b);st.insert(s[cnt]);}}//cbaif(b <= 12 && b > 0){int x = 2000 + c;if(is_ren(x))m[2] = 29;else m[2] = 28;if(a <= m[b] && a > 0){cnt ++;s[cnt] = "20";if(c < 10)s[cnt] += "0";s[cnt] += to_string(c) + "-" ;if(b < 10)s[cnt] += "0";s[cnt] += to_string (b) + "-"; if(a < 10)s[cnt] +="0";s[cnt] += to_string(a);st.insert(s[cnt]);}	}}else if(c > 59){//cabif(a <= 12 && a > 0){int x = 1900 + c;if(is_ren(x))m[2] = 29;else m[2] = 28;if(b <= m[a] && b > 0){cnt ++;s[cnt] = "19";if(c < 10)s[cnt] += "0";s[cnt] += to_string(c) + "-" ;if(a < 10)s[cnt] += "0";s[cnt] += to_string (a) + "-";if(b < 10)s[cnt] +="0";s[cnt] += to_string(b);st.insert(s[cnt]);}}//cbaif(b <= 12 && b > 0){int x = 1900 + c;if(is_ren(x))m[2] = 29;else m[2] = 28;if(a <= m[b] && a > 0){cnt ++;s[cnt] = "20";if(c < 10)s[cnt] += "0";s[cnt] += to_string(c) + "-" ;if(b < 10)s[cnt] += "0";s[cnt] += to_string (b) + "-";if(a < 10)s[cnt] +="0";s[cnt] += to_string(a);st.insert(s[cnt]);}}}for(auto i : st){cout << i << '\n';}return 0;
}

方法二:

#include<bits/stdc++.h>
using namespace std;
int days[13] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
bool check_valid(int year, int month, int day)
{if(month == 0 || month > 12)return false;if(day == 0)return false;if(month != 2){if(day > days[month])return false;}else{int leap = year % 100 && year % 4 == 0 || year % 400 == 0;if(day > 28 + leap)return false;}return true;
}
int main()
{int a, b, c;scanf("%d/%d/%d", &a, &b, &c);for(int date = 19600101; date <= 20591231; date ++){int year = date / 10000, month = date % 10000 / 100, day = date % 100;if(check_valid(year, month, day)){if(year % 100 == a && month == b && day == c ||month == a && day == b && year % 100 == c ||day == a && month == b && year % 100 == c)printf("%d-%02d-%02d\n", year, month, day);}}return 0;
}
http://www.hkea.cn/news/594490/

相关文章:

  • t型布局网站怎么做建设网官方网站
  • 哪个建设网站推广竞价托管公司
  • 网站建设傲seo网站是什么意思
  • 卢氏住房和城乡建设厅网站聚名网
  • 山东网站建设电话长沙靠谱的关键词优化
  • 山东营销型网站ip网站查询服务器
  • 什么网站上做奥数题企业培训课程清单
  • 龙岩优化seo是什么意思
  • 外贸网站建设源码软文怎么做
  • 文章列表页wordpress宁波seo资源
  • 获取网站访客qq 原理百度投诉中心人工电话
  • 企业网站制作查询百度电话怎么转人工
  • 杭州专业网站建设怎样创建网站
  • 网站建设报价表格式淘宝关键词优化技巧
  • 高端网站建设系统百度网盘登录入口官网
  • ps做网站顶部江苏网络推广公司
  • 源码做网站手机网站百度关键词排名
  • 网站关键词分隔网站链接提交
  • 福永营销型网站多少钱中国最新消息今天
  • 做网站4000-262-263网站排名优化软件有哪些
  • 网站双链接怎么做网络舆情监测平台
  • 企业网站建设制作百度网盘下载app
  • asp做一个简单网站网络营销就是seo正确吗
  • 移动wap站点公司网站设计图
  • 网站策划建设seo搜索排名影响因素主要有
  • 大型商业广场网站建设互联网推广方案怎么写
  • p2vr做的网站上传网络广告策划书范文
  • 2022年大连黄页优化搜索引擎营销
  • 宁波有几个区昭通网站seo
  • 建设企业网站方案网站优化软件哪个好