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. Backbone事件模块及其用法

    事件模块Backbone.Events在Backbone中占有十分重要的位置,其他模块Model,Collection,View所有事件模块都依赖它.通过继承Events的方法来实现事件的管理,可以说 ...

  2. KALI Linux problems & Study Red Hat | Ubuntu

    Problem When you ask some website with https head.you may met the problem  secure connection failed ...

  3. Web 常用功能测试方法

    功能测试就是对产品的各功能进行验证,根据功能测试用例,逐项测试,检查产品是否达到用户要求的功能.常用的测试方法如下: 1. 页面链接检查:每一个链接是否都有对应的页面,并且页面之间切换正确. 2. 相 ...

  4. The current identity (NT AUTHORITY/NETWORK SERVICE)

    IIS错误提示: The current identity (NT AUTHORITY/NETWORK SERVICE) does not have write access to 'C:/WINDO ...

  5. MySQL自增ID 起始值 修改方法

    在mysql中很多朋友都认为字段为AUTO_INCREMENT类型自增ID值是无法修改,其实这样理解是错误的,下面介绍mysql自增ID的起始值修改与设置方法. 通常的设置自增字段的方法: 创建表格时 ...

  6. ORACLE 中ROWNUM用法总结(转)

    ORACLE 中ROWNUM用法总结! 对于 Oracle 的 rownum 问题,很多资料都说不支持>,>=,=,between...and,只能用以上符号(<.<=.!=) ...

  7. org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [XXX] in DispatcherServlet with name 'springMVC'

    在web.xml中添加 <servlet-mapping> <servlet-name>default</servlet-name> <url-pattern ...

  8. 【Network】Neutron-Docker-K8S

    Neutron-Docker-K8S openstack/neutron: Neutron is a virtual network service for Openstack. Neutron和SD ...

  9. c模拟c++ const 转换

    #include <stdio.h> int main(){ const int constant = 21; const int* const_p = &constant; in ...

  10. js中JSON格式数据的转化

    JSON.parse(STRING) => OBJECT JSON.stringify(OBJECT) => STRING