题目链接 题意:给出n个点.用两种颜色来给每个点染色.问能否存在一种染色方式,使不同颜色的点不能被划分到一条直线的两侧. 题解:求个凸包(其实只考虑四个点就行.但因为有板子,所以感觉这样写更休闲一些.).如果不是所有点都在凸包上,那么把凸包上的点染成颜色1,内部的点染成颜色2:如果是所有点都在凸包上,且点数>3,那么将第一个和第三个点染成颜色1,其余点染成颜色2:否则,不存在满足要求的染色方式. 虽然很弱但是拿到一个一血还是非常开心的~ #include<bits/stdc++.h> u…
#1582 : Territorial Dispute 时间限制:1000ms 单点时限:1000ms 内存限制:256MB 描述 In 2333, the C++ Empire and the Java Republic become the most powerful country in the world. They compete with each other in the colonizing the Mars. There are n colonies on the Mars,…
#1582 : Territorial Dispute 时间限制:1000ms 单点时限:1000ms 内存限制:256MB 描述 In 2333, the C++ Empire and the Java Republic become the most powerful country in the world. They compete with each other in the colonizing the Mars. There are n colonies on the Mars,…
传送门 题意 略 分析 求一个凸包即可 1.所有点在凸包上且点数>3,令凸包上第1,3点为'A',其余点为'B' 2.部分点在凸包上,令凸包上点为'A',其余点为'B' 3.无可行情况 附代码 #include<bits/stdc++.h> using namespace std; typedef long long LL; const LL eps=1e-10; const LL pi=acos(-1.0); int dcmp(LL x) { if(x==0LL) return 0;…
题目链接:http://hihocoder.com/problemset/problem/1584 题意:就是求一个小球从矩阵的左上角,跑到矩形的右下角不能重复经过的格子,小球碰到墙壁就反射. 解法:规律题.先算出来小球一共会经过多少网格(包括重复的在内),再算出来有多少个网格过不止一次,两者相减就可以了.对于n*m的矩形,经过观察可以得到,小球弹跳中经过的网格总数是(n-1)*(m-1)/gcd(n-1,m-1)+1,对于9*15的矩形来说就是57.然后来考虑答案39和57的差值,18.对于1…
时间限制:5000ms 单点时限:5000ms 内存限制:256MB 描述 Profess X is an expert in signal processing. He has a device which can send a particular 1 second signal repeatedly. The signal is A0 ... An-1 under n Hz sampling. One day, the device fell on the ground accidenta…
题目链接 比赛时随便找了个规律,然后队友过了.不过那个规律具体细节还挺烦的.刚刚偶然看到Q巨在群里提到的他的一个思路,妙啊,很好理解,而且公式写起来也容易.OrzQ巨 #include<bits/stdc++.h> using namespace std; typedef long long LL; LL n,m; int main() { while(~scanf("%lld%lld",&n,&m)) { n--,m--; LL g=__gcd(n,m);…
#1636 : Pangu and Stones 时间限制:1000ms 单点时限:1000ms 内存限制:256MB 描述 In Chinese mythology, Pangu is the first living being and the creator of the sky and the earth. He woke up from an egg and split the egg into two parts: the sky and the earth. At the begi…
#1632 : Secret Poems 时间限制:1000ms 单点时限:1000ms 内存限制:256MB 描述 The Yongzheng Emperor (13 December 1678 – 8 October 1735), was the fifth emperor of the Qing dynasty of China. He was a very hard-working ruler. He cracked down on corruption and his reign wa…
Cats and Fish 时间限制:1000ms 单点时限:1000ms 内存限制:256MB 描述 There are many homeless cats in PKU campus. They are all happy because the students in the cat club of PKU take good care of them. Li lei is one of the members of the cat club. He loves those cats v…