知识点:字符串总结
注意事项在代码中
cpp#include <bits/stdc++.h> #define int long long //(有超时风险) #define PII pair<int,int> #define endl '\n' #define LL __int128 using namespace std; const int N=2e6+10,M=1e3+10,mod=998244353,INF=0x3f3f3f3f; int a[N],b[N],c[N],pre[N]; signed main() { std::ios::sync_with_stdio(false); std::cin.tie(nullptr); string s;cin>>s; string str[]={"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"}; //表示第0位开始3个字符 //判断月份 string tmp=s.substr(0,3); for(int i=0;i<12;i++) { if(str[i]==tmp) cout<<i+1<<' '; } //第3位开始到最后得字符串 //判读日 string ans=s.substr(3); for(int i=0;i<ans.size();i++) { if(i==0&&ans[i]=='0') continue; cout<<ans[i]; } return 0; }
P8722 [蓝桥杯 2020 省 AB3] 日期识别--2024蓝桥杯冲刺省一
一只蓝色小鲨鱼2024-02-05 19:34
相关推荐
剪一朵云爱着19 分钟前
力扣2438. 二的幂数组中查询范围内的乘积hz_zhangrl20 分钟前
CCF-GESP 等级考试 2025年6月认证C++三级真题解析测试老哥21 分钟前
Python+Selenium实现自动化测试肥猪猪爸2 小时前
BP神经网络对时序数据进行分类dongzhenmao4 小时前
P1484 种树,特殊情形下的 WQS 二分转化。EutoCool5 小时前
Qt:布局管理器Layout悠哉清闲6 小时前
C++ MediaCodec H264解码thusloop6 小时前
380. O(1) 时间插入、删除和获取随机元素MobotStone7 小时前
无代码+AI时代,为什么你仍然需要像个开发者一样思考测试老哥7 小时前
软件测试之单元测试