A - New Year and Hurry (water)

 #include <bits/stdc++.h>
 using namespace std;
 int main()
 {
     ];
     ; i <= ; i++)
     {
         a[i] = ( + i) * i /  * ;
     }
     int n ,k;
     while(~scanf("%d%d", &n, &k))
     {
         ;
         ; i <= n; i++)
         {
              - k >= a[i])  ans = i;
         }
         printf("%d\n", ans);
     }
     ;
 }

B - New Year and North Pole(water)

题意:往东南西北走,最后一定要到达北极,走的方式有限制。注意坑点。

 #include <bits/stdc++.h>
 using namespace std;
 ;
 int main()
 {
     int n;
     while(~scanf("%d", &n))
     {
         , ok  = ;
         ; i < n; i++)
         {
             ];
             int dis;
             scanf("%d%s", &dis, dir);
             ] ==  'S')
             {
                 if(cur == con || dis > con || cur + dis > con)
                 {
                     ok = ;
                 }
                 cur += dis;
             }
             ] == 'N')
             {
                  || dis > con || cur - dis < )
                 {
                     ok = ;
                 }
                 cur -= dis;
             }
             else
             {
                  || cur == con)  ok = ;
             }
         }
         )    ok = ;
         if(ok)
         {
             printf("YES\n");
         }
         else
         {
             printf("NO\n");
         }
     }
     ;
 }

C - New Year and Rating(脑洞?思维?)

题意:给你一系列比赛的分数变化值和参加的级别,问你参加完这些比赛后,你的最大rating是多少。

思路:

  感觉自己想复杂了,写的又臭又长还错,其实就是维护一个最大值,一个最小值,代表参加这些比赛之前你的rating初始值的范围,然后不断更新这个范围就行了。

阿西吧,想到了维护最大最小值,但是没有用前缀和来做,你会发现每场比赛的时候无非是,rating + sum[i - 1] >= 1900,或者,rating + sum[i - 1] <= 1899两种状态,这么水的题,相岔了= =。

 #include <bits/stdc++.h>
 using namespace std;
  + ;
 const int INF = 0x3f3f3f3f;
 int sum[maxn];
 int main()
 {
     int n;
     while(~scanf("%d", &n))
     {
         sum[] = ;
         ;
         ; i <= n; i++)
         {
             int c, d;
             scanf("%d%d", &c, &d);
             sum[i] = sum[i - ] + c;
             )
             {//rating + sum[i-1] >= 1900
                 minn = max(minn,  - sum[i - ]);
             }
             )
             {//rating + sum[i-1] <= 1899
                 maxx = min(maxx,  - sum[i - ]);
             }
             ;
         }
         )
         {
             if(maxx != INF)
             {
                 printf("%d\n", maxx + sum[n]);
             }
             else
             {
                 printf("Infinity\n");
             }
         }
         else
         {
             printf("Impossible\n");
         }
     }
     ;
 }

D - New Year and Fireworks(分形)

题意:

思路:

  我觉得这题挺好的,练练分形的思想,递归的写法,听完思路,发现自己实现无能,有点懵。然后推一个数学里头的沿直线对称,得到对应坐标点就行了。

  关于(i,j)点关于直线y=f(x), y=g(x)对称的点(x',y'),初中不是学过嘛,x' = g(j),y' = f(i)。不知道这个结论的话....初中数学的知识也够推的,过(i,j)做一条垂直于y=f(x)的直线,然后求交点,然后根据交点和(i,j)得到对称点。

  其实这题可以直接暴力模拟,不需要分形的去考虑。不过我还是想练练分形的写法,补一下。

 #include <bits/stdc++.h>
 using namespace std;
 ;
 ], n;
 ][maxn][maxn];
 , };
 , };

 void map_reverse(int pax, int pay, int dir, int cur)
 {
     ; i < maxn; i++)
     {
         ; j < maxn; j++)
         {
             ][i][j])
             {
                 ma[cur][i][j] = true;
                 )
                     ma[cur][j + (pax - pay)][i - (pax - pay)] = true;
                 )
                     ma[cur][ * pax - i][j] = true;
             }
         }
     }
 }

 void f(int pax, int pay, int dir, int cur)
 {
     if(cur != n)
     {
         f(pax + dx[dir] * (t[cur] - ) + dx[dir ^ ], pay + dy[dir] * (t[cur] - ) + dy[dir ^ ], dir ^ , cur + );
         map_reverse(pax, pay, dir, cur);
     }

     ; i < t[cur]; i++)
     {
         ma[cur][pax + dx[dir] * i][pay + dy[dir] * i] = true;
     }
 }

 int main()
 {
     scanf("%d", &n);
     ; i <= n; i++)
     {
         scanf("%d", &t[i]);
     }
     f(maxn / , maxn / , , );
     ;
     ; i < maxn; i++)
     {
         ; j < maxn; j++)
         {
             ][i][j])
                 cnt++;
         }
     }
     printf("%d\n", cnt);
     ;
 }

Good Bye 2016的更多相关文章

  1. codeforces Good bye 2016 E 线段树维护dp区间合并

    codeforces Good bye 2016 E 线段树维护dp区间合并 题目大意:给你一个字符串,范围为‘0’~'9',定义一个ugly的串,即串中的子串不能有2016,但是一定要有2017,问 ...

  2. Good Bye 2016 A. New Year and Hurry【贪心/做题目每道题花费时间按步长为5等差增长,求剩余时间够做几道题】

    A. New Year and Hurry time limit per test 1 second memory limit per test 256 megabytes input standar ...

  3. Codeforces Good Bye 2016 E. New Year and Old Subsequence

    传送门 题意: 给出一个长度为\(n\)的串,现在有\(q\)个询问,每个询问是一个区间\([l,r]\),要回答在区间\([l,r]\)中,最少需要删多少个数,满足区间中包含\(2017\)的子序列 ...

  4. Good Bye 2016 - D

    题目链接:http://codeforces.com/contest/750/problem/D 题意:新年烟花爆炸后会往两端45°差分裂.分裂完后变成2部分,之后这2部分继续按这种规则分裂.现在给你 ...

  5. Good Bye 2016 - C

    题目链接:http://codeforces.com/contest/750/problem/C 题意:在CF中,每个人都有个Rank值. 当Rank>=1900时,为DIV1.Rank< ...

  6. Good Bye 2016 - B

    题目链接:http://codeforces.com/contest/750/problem/B 题意:地球的子午线长度为40000,两极点的距离为20000.现在你从北极出发,按照题目输入方式来走. ...

  7. Good Bye 2016 - A

    题目链接:http://codeforces.com/contest/750/problem/A 题意:有n场比赛要打,第i场比赛需要花i*5分钟来完成,比赛从20:00开始.然后新年派对24:00开 ...

  8. Good Bye 2016 //智商再次下线,边界爆炸.....

    A B很水就略了.. C.又是一次wannafly一样的判断区间的.....  边界设为2000000  正好GG...... fst的时候立马想到上次也是这么wa过的...... 所以下次遇到这种题 ...

  9. Codeforces Good Bye 2016 D 模拟搜索?

    给出烟花的爆炸方式和爆炸次数 问最后有多少个格子会被炸到 如果dfs的话会超时... 利用模拟每一层来搜索..? 思想就是一开始有一个爆炸点向上 然后模拟完第一段 会产生一个爆炸点 朝两个方向 就用v ...

随机推荐

  1. DI中Transient Scoped Singleton Instance的区别

    Observe which of the OperationId values varies within a request, and between requests. Transient obj ...

  2. shell if 浮点数比较

    转shell中的浮点数比较http://nigelzeng.iteye.com/blog/1604640 博客分类: Bash Shell shell比较浮点数  由于程序需要,我要判断一个浮点数是否 ...

  3. Excel——MATCH函数

    使用 MATCH 函数在范围单元格中搜索特定的项,然后返回该项在此区域中的相对位置. 1.参数说明: MATCH(lookup_value, lookup_array, [match_type]) l ...

  4. 为什么axios请求接口会发起两次请求

    之前在使用axios发现每次调用接口都会有两个请求,第一个请求时option请求,而且看不到请求参数,当时也没注意,只当做是做了一次预请求,判断接口是否通畅,但是最近发现并不是那么回事. 首先我们知道 ...

  5. 详解Node解析URL网址

    前提给大家声明一下,我操作的环境是Mac终端下操作的.(前提是你先要下载好node.js) 说道URL 恐怕都不陌生,但是要说URL,就 必须先说下URI URI是统一资源标识符,是一个用于标识某一互 ...

  6. PhotoSwipe插件的使用

    1.首先引入插件 <link rel="stylesheet" href="css/photoswipe.css"> <link rel=&q ...

  7. Struts开发包结构

  8. docker swarm-mode

    root@node1:~# docker versionClient: Version: 1.12.3 API version: 1.24 Go version: go1.6.3 Git commit ...

  9. 使用外部web组件-----easyUI、jQueryUI、Bootstrap、js正则表达式

    1.使用外部web组件,以Bootstrap为例 <head> <link rel='stylesheet'  href='bootstrap-3.3.0-dist/dist/css ...

  10. [Linux]I/O多路复用和epoll

    首先我们来定义流的概念,一个流可以是文件,socket,pipe等等可以进行I/O操作的内核对象. 不管是文件,还是套接字,还是管道,我们都可以把他们看作流. 之后我们来讨论I/O的操作,通过read ...