A. Whose sentence is it?

  • 模拟。

B. Archer

  • \[pro=\frac{a}{b}+(1-\frac{a}{b})(1-\frac{c}{d})\frac{a}{b}+(1-\frac{a}{b})^2(1-\frac{c}{d})^2\frac{a}{b}+…\]
  • 本质就是无穷级数求和。

C. The Closest Pair

  • 因为根据\(x\)坐标差值优化,那么只要构造\(x\)坐标都一样的即可。

D. Cats Transport

  • 假设一人在时间T出发,则所有满足\(T+D[h_i]\ge t_i\)的猫都会被带走,所以按\(t_i-D[h_i]\)排序,就可以用\(dp\)做。
  • \(dp(i,j)\)表示前\(i\)只猫\(j\)个人的最小代价。
  • 写出转移方程后,发现可以用斜率优化做。

E. Fetch the Treasure

  • 问题主要在于如何确定一个格子是否可达。我们可以将格子按\(pos\ \%\ k\)分组,对于一个组\(g\)来说,我们只要确定\(min\{pos,pos\ \%\ k =g\}\),那么大于等于最小值的点都是可达的,由于\(k\le 10^4\),所以使用\(dijkstra\)求最小值即可。

F. Interval Cubing

  • 根据Fermat's Little Theorem,\(x^{p-1}=1(mod\ p)\)。
  • 对一个数\(x\)操作\(k\)次后,\(x'=x^{3^k\ mod \ (p-1)}(mod\ p)\)。
  • 因为\(3^{48}\ mod\ 95542720 = 1\),所以循环节为48。那么对于每个数维护48个值即可。

G. Biologist

  • 总收益为\(\sum{w_i}\),考虑总收益扣除最小代价,将问题转化为最小割问题。
  • 根据狗的性别划分成二部图。源点\(S\)连接性别为1的狗,容量为\(v_i\),汇点\(T\)连性别为0的狗。
  • 若人的需求是0,则与源点\(S\)连接代价为\(w_i+isfriend*g\)的边,跟狗都连\(INF\)的边。若需求是1,则与汇点\(T\)连接代价为\(w_i+isfriend*g\)的边,狗同上。

Codeforces Round #185 (Div. 1 + Div. 2)的更多相关文章

  1. Educational Codeforces Round 60 (Rated for Div. 2) - C. Magic Ship

    Problem   Educational Codeforces Round 60 (Rated for Div. 2) - C. Magic Ship Time Limit: 2000 mSec P ...

  2. Educational Codeforces Round 60 (Rated for Div. 2) - D. Magic Gems(动态规划+矩阵快速幂)

    Problem   Educational Codeforces Round 60 (Rated for Div. 2) - D. Magic Gems Time Limit: 3000 mSec P ...

  3. Educational Codeforces Round 43 (Rated for Div. 2)

    Educational Codeforces Round 43 (Rated for Div. 2) https://codeforces.com/contest/976 A #include< ...

  4. Educational Codeforces Round 35 (Rated for Div. 2)

    Educational Codeforces Round 35 (Rated for Div. 2) https://codeforces.com/contest/911 A 模拟 #include& ...

  5. Codeforces Educational Codeforces Round 44 (Rated for Div. 2) F. Isomorphic Strings

    Codeforces Educational Codeforces Round 44 (Rated for Div. 2) F. Isomorphic Strings 题目连接: http://cod ...

  6. Codeforces Educational Codeforces Round 44 (Rated for Div. 2) E. Pencils and Boxes

    Codeforces Educational Codeforces Round 44 (Rated for Div. 2) E. Pencils and Boxes 题目连接: http://code ...

  7. Educational Codeforces Round 63 (Rated for Div. 2) 题解

    Educational Codeforces Round 63 (Rated for Div. 2)题解 题目链接 A. Reverse a Substring 给出一个字符串,现在可以对这个字符串进 ...

  8. Educational Codeforces Round 39 (Rated for Div. 2) G

    Educational Codeforces Round 39 (Rated for Div. 2) G 题意: 给一个序列\(a_i(1 <= a_i <= 10^{9}),2 < ...

  9. Educational Codeforces Round 48 (Rated for Div. 2) CD题解

    Educational Codeforces Round 48 (Rated for Div. 2) C. Vasya And The Mushrooms 题目链接:https://codeforce ...

  10. Educational Codeforces Round 60 (Rated for Div. 2) 题解

    Educational Codeforces Round 60 (Rated for Div. 2) 题目链接:https://codeforces.com/contest/1117 A. Best ...

随机推荐

  1. go strcut 封装

    package model import "fmt" type person struct { Name string age int //其它包不能直接访问.. sal floa ...

  2. 【水滴石穿】ReactNative-Redux-Thunk

    老实说,运行出来的项目让人失望,毕竟我想看各种有趣的demo啊- 先放上源码地址:https://github.com/ludejun/ReactNative-Redux-Thunk 我们来一起看看代 ...

  3. Ubuntu无法连接无线网

    shell里输入: su ifconfig wlan0 up 不行的话 rfkill block all rfkill unblock all ifconfig wlan0 up

  4. IDEA(JAVA)使用json

    首先介绍一下json SON是一种取代XML的数据结构,和xml相比,它更小巧但描述能力却不差,由于它的小巧所以网络传输数据将减少更多流量从而加快速度. JSON就是一串字符串 只不过元素会使用特定的 ...

  5. Linux中的库

    一.基本概念 1.1.什么是库        在 windows 平台和 linux 平台下都大量存在着库. 本质上来说库是一种可执行的二进制代码(但不可以独立执行),可以被操作系统载入内存执行. 由 ...

  6. Ubuntu里node命令无效解决方法

    在ubuntu里用sudo apt-get install nodejs安装Node.js后, 会发现terminals里运行node命令(比如node –-version)时候会有No such f ...

  7. this的作用

    1.在一般函数方法中使用 this 指代全局  function test(){ this.x = 1; alert(this.x);  }  test(); // 1 2.作为对象方法调用,this ...

  8. EL表达式简单总结

    EL表达式 ## EL表达式的取值范围 JSP的四个作用域: pagecontext(生命周期用户离开或者跳转页面,作用域范围这个页面) request(生命周期用户离开页面,作用于这个页面) ses ...

  9. Atcoder Tenka1 Programmer Contest C C - 4/N

    http://tenka1-2017.contest.atcoder.jp/tasks/tenka1_2017_c 我怀疑我是不是智障.... 本来一直的想法是能不能构造出答案,把N按奇偶分,偶数好办 ...

  10. mysql字段中提取汉字,去除数字以及字母

    如果只是删除尾部的中文,保留数据,可以用以下的简单方式 MySQL as num; +------+ | num | +------+ | +------+ DELIMITER $$ DROP FUN ...