wojiaocbj

Untitled

May 20th, 2022
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.91 KB | None | 0 0
  1. /*
  2.  Author: 曹北健(37509)
  3.  Result: AC Submission_id: 4472922
  4.  Created at: Sat May 21 2022 10:57:01 GMT+0800 (China Standard Time)
  5.  Problem: 5789  Time: 5 Memory: 1680
  6. */
  7.  
  8. /*
  9.  Author: 徐思璐(49859)
  10.  Result: WA Submission_id: 4472841
  11.  Created at: Sat May 21 2022 10:50:15 GMT+0800 (China Standard Time)
  12.  Problem: 5789  Time: 4 Memory: 1748
  13. */
  14.  
  15. #include <stdio.h>
  16. #include <string.h>
  17. #include <stdlib.h>
  18. #include<math.h>
  19. #include<ctype.h>
  20.  
  21.  
  22. int main()
  23. {
  24.     FILE* fp;
  25.     int op;
  26.     fp = freopen("301.txt", "a",stdout);
  27.     int n, i;
  28.     scanf("%d", &n);
  29.     for (i = 0; i < n; i++) {
  30.         scanf("%d", &op);
  31.         if (op == 1) {
  32.         int a, b;
  33.         scanf("%d%d", &a, &b);
  34.         printf("%d\n", a + b);
  35.     }
  36.     else if (op==2) {
  37.         long long a, b;
  38.         scanf("%lld%lld", &a, &b);
  39.         printf("%lld\n", a + b);
  40.     }
  41.     else {
  42.         double a, b;
  43.         scanf("%lf%lf", &a, &b);
  44.         printf("%.5f\n", a + b);
  45.     }
  46.     }
  47.    
  48.    
  49.     fclose(fp);
  50.     return 0;
  51. }
Advertisement
Add Comment
Please, Sign In to add comment