wojiaocbj

calendar3

Mar 30th, 2022
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.69 KB | None | 0 0
  1. /*
  2.  Author: 曹北健
  3.  Result: AC Submission_id: 4264867
  4.  Created at: Wed Mar 30 2022 23:09:57 GMT+0800 (China Standard Time)
  5.  Problem_id: 5443   Time: 4 Memory: 1748
  6. */
  7.  
  8. #include <stdio.h>
  9. #include <time.h>
  10. #include <string.h>
  11. typedef long long LL;
  12. typedef unsigned long long ULL;
  13. int main(){
  14.  
  15.     time_t tim0 = 0;
  16.     struct tm *pt, tmp = { 0 }, tmp2;
  17.     int n, y, d;
  18.     scanf("%d", &n);
  19.     while(n--){
  20.         memset(&tmp, 0, sizeof(tmp));
  21.         scanf("%d%d", &y, &d);
  22.         tmp.tm_year = y - 1900;
  23.         tim0 = mktime(&tmp);
  24.         tim0 += (d * (60 * 60 * 24));
  25.         pt = localtime(&tim0);
  26.         if(pt){
  27.             memcpy(&tmp2, pt, sizeof(tmp2));
  28.             printf("%d %d\n", tmp2.tm_mon + 1, tmp2.tm_mday);
  29.         }
  30.     }
  31.     return 0;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment