51假期当然不能空着,得逼着队友一起训练。然而队友手感挺好的,我却不是很在状态。

把简单的题都切了,剩下的都是通过人数个位数的神仙题。

题目链接:http://codeforces.com/gym/102190


 A:

签到题。根据长度暴力塞进去就好了。

 1 /* basic header */
 2 #include <iostream>
 3 #include <cstdio>
 4 #include <cstdlib>
 5 #include <string>
 6 #include <cstring>
 7 #include <cmath>
 8 #include <cstdint>
 9 #include <climits>
10 #include <float.h>
11 /* STL */
12 #include <vector>
13 #include <set>
14 #include <map>
15 #include <queue>
16 #include <stack>
17 #include <algorithm>
18 #include <array>
19 #include <iterator>
20 /* define */
21 #define ll long long
22 #define dou double
23 #define pb emplace_back
24 #define mp make_pair
25 #define fir first
26 #define sec second
27 #define sot(a,b) sort(a+1,a+1+b)
28 #define rep1(i,a,b) for(int i=a;i<=b;++i)
29 #define rep0(i,a,b) for(int i=a;i<b;++i)
30 #define repa(i,a) for(auto &i:a)
31 #define eps 1e-8
32 #define int_inf 0x3f3f3f3f
33 #define ll_inf 0x7f7f7f7f7f7f7f7f
34 #define lson curPos<<1
35 #define rson curPos<<1|1
36 /* namespace */
37 using namespace std;
38 /* header end */
39 
40 const int maxn = 10;
41 char s[maxn];
42 
43 int main()
44 {
45     scanf("%s", s + 1);
46     int len = strlen(s + 1);
47     int sh = 0, th = 0, day;
48     if (len == 3)
49     {
50         sh = s[1] - '0'; th = 12 + s[2] - '0'; day = s[3] - '0';
51     }
52     else if (len == 5)
53     {
54         sh = (s[1] - '0') * 10 + s[2] - '0';
55         th = 12 + (s[3] - '0') * 10 + s[4] - '0';
56         day = s[5] - '0';
57     }
58     else
59     {
60         sh = (s[1] - '0') * 10 + s[2] - '0';
61         th = 12 + s[3] - '0';
62         day = s[4] - '0';
63         if ((sh < 2 || sh > 11) || (th < 14 || th > 23))
64         {
65             sh = s[1] - '0';
66             th = 12 + (s[2] - '0') * 10 + s[3] - '0';
67         }
68     }
69     printf("%d\n", day * (th - sh));
70     return 0;
71 }
View Code

相关文章:

  • 2021-08-05
  • 2021-10-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-15
  • 2021-08-04
  • 2022-02-06
猜你喜欢
  • 2021-12-01
  • 2022-02-09
  • 2022-12-23
  • 2022-02-13
  • 2021-10-22
相关资源
相似解决方案