上一页 1 ··· 44 45 46 47 48 49 50 51 52 ··· 67 下一页
摘要: 在读入日期时判断该日期是否在合法日期的区间内,如果在,就使其更新最年长的人的出生日期和最年轻的人的出生日期。由于判断日期是否在合法日期区间 内、更新最年长和最年轻的信息都将涉及日期的比较操作,因此不妨写两个比较函数用来比较a与b的日期。 ps:有可能存在所有人的日期都不在合法区间内的情况,这时必须特 阅读全文
posted @ 2021-02-12 13:48 Dazzling! 阅读(50) 评论(0) 推荐(0) 编辑
摘要: 水题~。 值得一提的是没有显式给出$n$的范围,所以要求空间复杂度$O(1)$咯。 struct Node { string name; string id; int grade; }cur,maxv,minv; int n; int main() { cin>>n; maxv.grade=-1,m 阅读全文
posted @ 2021-02-12 12:38 Dazzling! 阅读(42) 评论(0) 推荐(0) 编辑
摘要: 水题~。 const int N=1010; struct Node { string id; int try_id; int test_id; }a[N]; map<int,Node> mp; int n,m; int main() { cin>>n; for(int i=0;i<n;i++) { 阅读全文
posted @ 2021-02-12 12:32 Dazzling! 阅读(24) 评论(0) 推荐(0) 编辑
摘要: 求多个数的lcm,水题~ int n; int gcd(int a,int b) { return b?gcd(b,a%b):a; } int lcm(int a,int b) { return a/gcd(a,b)*b; } int main() { int T; cin>>T; while(T- 阅读全文
posted @ 2021-02-12 12:21 Dazzling! 阅读(29) 评论(0) 推荐(0) 编辑
摘要: 如果求导之后没有任何非零项,需要输出0 0。 int main() { string line; getline(cin,line); stringstream ss(line); int a,b; bool first=true; while(ss>>a>>b) { a*=b; b--; if(b 阅读全文
posted @ 2021-02-12 11:26 Dazzling! 阅读(35) 评论(0) 推荐(0) 编辑
摘要: 模拟题。 const int N=55; string mp[]={"S","H","C","D","J"}; string s[N]; string t[N]; int p[N]; int n; int cnt; void init() { for(int i=0;i<4;i++) for(int 阅读全文
posted @ 2021-02-11 21:56 Dazzling! 阅读(21) 评论(0) 推荐(0) 编辑
摘要: 直接输出移位后结果,注意行末空格的处理。 const int N=110; int a[N]; int n,m; int main() { cin>>n>>m; for(int i=0;i<n;i++) cin>>a[i]; m%=n; for(int i=n-m;i<n;i++) cout<<a[ 阅读全文
posted @ 2021-02-11 17:41 Dazzling! 阅读(19) 评论(0) 推荐(0) 编辑
摘要: 水题~ int n; int main() { cin>>n; int cnta=0,cntb=0; for(int i=0;i<n;i++) { int a,suma,b,sumb; cin>>a>>suma>>b>>sumb; if(suma == a+b && sumb != a+b) cnt 阅读全文
posted @ 2021-02-11 17:23 Dazzling! 阅读(26) 评论(0) 推荐(0) 编辑
摘要: 水题~,就简单转换下时间。 int a,b; int main() { cin>>a>>b; int tim=round((b-a)/100.0); int hh=tim/3600,mm=tim%3600/60,ss=tim%3600%60; printf("%02d:%02d:%02d\n",hh 阅读全文
posted @ 2021-02-11 17:16 Dazzling! 阅读(20) 评论(0) 推荐(0) 编辑
摘要: 如果$n$是奇数,则说明没有满足要求的答案,输出$0$ \(0\)。 如果$n$是偶数且能被$4$整除,则最少有$n/4$只兔子,最多有$n/2$只鸡。 如果$n$是偶数且不能被$4$整除,则最少有$(n-2)/4$只兔子和$1$只鸡,最多有$n/2$只鸡。 int n; int main() { 阅读全文
posted @ 2021-02-11 17:10 Dazzling! 阅读(77) 评论(0) 推荐(0) 编辑
上一页 1 ··· 44 45 46 47 48 49 50 51 52 ··· 67 下一页