标签:count 20 int minlength 1028 PTA chr include
1028 人口普查 (20分)
https://pintia.cn/problem-sets/994805260223102976/problems/994805293282607104
#include <iostream> #include <cstring> #include <string> #include <cmath> #include <algorithm> using namespace std; int main() { int n; char chr[6],maxchr[6],minchr[6]; int year,month,day,length,count=0; int maxlength=20140907,minlength=18140905; cin>>n; for(int i=0;i<n;i++) { scanf("%s %d/%d/%d",chr,&year,&month,&day); length=year*10000+month*100+day; if(length>=18140906&&length<=20140906){ count++; if(length<maxlength) { strcpy(maxchr,chr); maxlength=length; } if(length>minlength) { strcpy(minchr,chr); minlength=length; } } } if(count) cout<<count<<" "<<maxchr<<" "<<minchr<<endl; else cout<<"0"<<endl; return 0; }
标签:count,20,int,minlength,1028,PTA,chr,include 来源: https://www.cnblogs.com/jianqiao123/p/12247139.html
本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享; 2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关; 3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关; 4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除; 5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。