当前位置:网站首页>L1-075 obsessive compulsive disorder (10 points)
L1-075 obsessive compulsive disorder (10 points)
2022-04-22 23:56:00 【NEFU AB-IN】
Powered by:NEFU AB-IN
List of articles
L1-075 Obsessive compulsive disorder (10 branch )
-
The question
Xiaoqiang is counting the date of birth of residents in a community , But I found that the birthday format filled in by everyone is not uniform , For example, some people write 199808, Some people only write 9808. Xiaoqiang with obsessive-compulsive disorder, please write a program , Put everyone's date of birth into Year after year - The moon Format . For those who only write the last two digits of the year , We default to less than 22 All are 20 At the beginning , Others are 19 At the beginning .
-
Ideas
Add C++ string The correlation function of
stolltake string Turn into long longto_string()Convert any type to stringstrstr(s1, s2)kmp Complexity , find s2 stay s1 The first subscript instring.c_str()It can be understood as string Turn into char Array output , In this way, we can%sOutput
-
Code
/* * @Author: NEFU AB-IN * @Date: 2022-04-22 16:45:11 * @FilePath: \ACM\GPLT\L1-075.CPP * @LastEditTime: 2022-04-22 16:56:30 */ #include <bits/stdc++.h> using namespace std; #define int long long #define MP make_pair #define SZ(X) ((int)(X).size()) #define IOS \ ios::sync_with_stdio(false); \ cin.tie(0); \ cout.tie(0); #define DEBUG(X) cout << #X << ": " << X << endl; typedef pair<int, int> PII; const int INF = 0x3f3f3f3f; signed main() { IOS; string s, year, month; cin >> s; if (SZ(s) == 6) { year = s.substr(0, 4); month = s.substr(4, 2); printf("%s-%s", year.c_str(), month.c_str()); } else { year = s.substr(0, 2); month = s.substr(2, 2); int y = stoll(year); if (y < 22) printf("20%s-%s", year.c_str(), month.c_str()); else printf("19%s-%s", year.c_str(), month.c_str()); } return 0; }
版权声明
本文为[NEFU AB-IN]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204222353025484.html
边栏推荐
- Introduction to cloud computing simulation framework cloudsim (screenshot version)
- unbuntu18. 04 installing gamit10 71 problem solution
- Hypermesh-laminate复合材料案例学习笔记
- SystemVerilog verification - Test Platform writing guide learning notes (3): connecting design and test platform
- Good and bad articles on Technology
- 字体自适应
- 【事务管理】
- English pronunciation and notes commonly used in OC
- 选中所有的文字
- SystemVerilog verification - Test Platform preparation guide learning notes (1): data types
猜你喜欢

pycharm界面改为中文,中英文切换

Django creates table structure and adds, deletes, modifies and queries database

matlab-day01

LabVIEW实现应用程序停止或退出

Notes on "Introduction to dynamic programming" (under update)

Robot OS System Architecture Design

Mysql的字段类型详解

浅谈LD_PRELOAD劫持

【leetcode】二叉树,654最大二叉树,105根据前序与中序遍历构造二叉树,106根据中序与后序遍列构造二叉树,889根据前序和后序遍历构造二叉树

stm32f103 独立看门狗
随机推荐
Hello, I want to open an account for crude oil futures. How can I open an account for futures safely and reliably?
ssh: connect to host 172.31.8.132 port 22: Connection refused
Reg 正则表达式学习笔记
Notes on "Introduction to dynamic programming" (under update)
Interpretation of UVM source code, uvm-1.2 code review notes
FPGA(六)RTL代码之二(复杂电路设计1)
【leetcode】二叉树,654最大二叉树,105根据前序与中序遍历构造二叉树,106根据中序与后序遍列构造二叉树,889根据前序和后序遍历构造二叉树
[PCIe 6.0] new features of PCIe 6.0 - detailed explanation of l0p
FileNotFoundError: [Errno 2] No such file or directory: 'image/1. Jpg 'problem solving
"New programmer 003" was officially launched, and the cloud native and digital combat experience of 30 + companies such as Huawei and Alibaba
Failed to execute goal on project xxxxx
浅谈LD_PRELOAD劫持
字體自適應
[transaction management]
51 single chip microcomputer learning_ 4-1 nixie tube display
Typora樣式調優
[superpower] I want to pause time and space
Vs-写汇编
[Objective-C advanced programming] - GCD
The parameter configuration of websoket package is out of the box