码迷,mamicode.com
首页 > 其他好文 > 详细

P1095-守望者的逃离

时间:2019-08-17 14:20:45      阅读:75      评论:0      收藏:0      [点我收藏+]

标签:printf   solution   www   --   typedef   put   +=   max   putc   

 1 #pragma GCC optimize("Ofast")
 2 #include <bits/stdc++.h>
 3 #define maxn 13003
 4 #define _for(i,a,b) for(int i = (a);i < b;i ++)
 5 typedef long long ll;
 6 using namespace std;
 7 
 8 inline ll read()
 9 {
10     ll ans = 0;
11     char ch = getchar(), last =  ;
12     while(!isdigit(ch)) last = ch, ch = getchar();
13     while(isdigit(ch)) ans = (ans << 1) + (ans << 3) + ch - 0, ch = getchar();
14     if(last == -) ans = -ans;
15     return ans;
16 }
17 inline void write(ll x)
18 {
19     if(x < 0) x = -x, putchar(-);
20     if(x >= 10) write(x / 10);
21     putchar(x % 10 + 0);
22 }
23 int M,S,T;
24 int SS,TT;
25 int main()
26 {
27     M = read(),S = read(),T = read();
28     SS = S;TT = T;
29     int i;
30     for(i = 0;i < T;i ++)
31     {
32         if(S <= 0) break;
33         if(M >= 10)
34         {
35             M -= 10;
36             S -= 60;
37         }
38         else if(((T-i<=1||S<=17)&&M<10) || ((T-i<=2||S<=34)&&M<6)
39          || ((T-i<=3||S<=51)&&M<2) || ((T-i<=4||S<=68)&&M<2)
40          || ((T-i<=5||S<=85)&&M<2) || ((T-i<=6||S<=102)&&M<2)
41          || (S<=119&&M<2))
42             S -= 17;
43         else if(M >= 2)
44             M += 4;
45         else if(S >= 120 && T-i >= 7)
46         {
47             while(S >= 120 && T-i >= 7)
48             {
49                 i += 7;
50                 S -= 120;
51             }
52             i --;
53         }
54     }
55     if(S <= 0)
56         printf("Yes\n%d\n",i);
57     else
58         printf("No\n%d\n",SS-S);
59     return 0;
60 }

https://www.luogu.org/blog/Asurudo/solution-p1095

P1095-守望者的逃离

标签:printf   solution   www   --   typedef   put   +=   max   putc   

原文地址:https://www.cnblogs.com/Asurudo/p/11368290.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!