// Codeforces Round #365 (Div. 2) // C - Chris and Road 二分找切点 // 题意:给你一个凸边行,凸边行有个初始的速度往左走,人有最大速度,可以停下来,竖直走. // 问走到终点的最短时间 // 思路: // 1.贪心来做 // 2.我觉的二分更直观 // 可以抽象成:一条射线与凸边行相交,判断交点.二分找切点 #include <bits/stdc++.h> using namespace std; #define LL long lon…
Chris and Road 题意: 给一个n个顶点的多边形的车,有速度v,人从0走到对面的w,人速度u,问人最快到w的时间是多少,车如果挡到人,人就不能走. 题解: 这题当时以为计算几何,所以就没做,其实真的应该认真想想的,一般cf前3题仔细想想是可以出的,其实思路很简单,如下: 题解:一共有三种情况: ①. 人以最大速度u前进时,汽车的速度很慢,任意一点都到达不了人的位置 ②.人以最大速度u前行时,汽车的速度很快,在人达到之前汽车的任意一点都已经通过了y轴 ③.人以最大速度u前进时,会与汽车…
A题 Mishka and Game 水..随便统计一下就A了 #include <cstdio> #include <map> #include <set> #include <queue> #include <cstring> #include <algorithm> #include <iostream> #include <cmath> using namespace std; typedef long…
A. Mishka and Game time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Mishka is a little polar bear. As known, little bears loves spending their free time playing dice for chocolates. Once in…
B. Chris and Magic Square 题目连接: http://www.codeforces.com/contest/711/problem/B Description ZS the Coder and Chris the Baboon arrived at the entrance of Udayland. There is a n × n magic grid on the entrance which is filled with integers. Chris notice…
Description Mishka is a little polar bear. As known, little bears loves spending their free time playing dice for chocolates. Once in a wonderful sunny morning, walking around blocks of ice, Mishka met her friend Chris, and they started playing the g…
Chris and Magic Square 题目链接: http://codeforces.com/contest/711/problem/B Description ZS the Coder and Chris the Baboon arrived at the entrance of Udayland. There is a n × n magic grid on the entrance which is filled with integers. Chris noticed that…
http://codeforces.com/contest/703/problem/E 题意:给定一个最多个数的序列,从中选出最少个数的数字,使得他们的乘积是k的倍数,若有多种选择方式,输出选出数字和最小的一种,若有多种,输出任意一种. 动态规划,dp[i][j]表示从前i个数里选,所得乘积是j的倍数.显然dp[i][j]=max(dp[i-1][j],dp[i-1][j/gcd(j,a[i])]).由于k可能很大,所以只需令j分别等于k的每个约数即可. 确定k的约数的时候令i从1到sqrt(k…
题目链接:http://codeforces.com/contest/703/problem/D 思路:看了神犇的代码写的... 偶数个相同的数异或结果为0,所以区间ans[l , r]=区间[l , r]每个数相异或^区间[l , r]出现过的数相异或.如数组1,2,1,3,3,2,3,则ans[1 , 7]=(1^2^1^3^3^2^3)^(1^2^3) 前半部分可以处理出前缀异或,后半部分先对询问按r进行排序,处理过程中相同的数只保留最后一个. #include<bits/stdc++.h…
题目链接: http://codeforces.com/contest/703/problem/D D. Mishka and Interesting sum time limit per test 3.5 secondsmemory limit per test 256 megabytes 问题描述 Little Mishka enjoys programming. Since her birthday has just passed, her friends decided to prese…