比赛地址:http://acm.uestc.edu.cn/#/contest/show/191 A题 小羽涂色 题意: 在x轴的正半轴上,问你是否存在一段区间[L,R]其中包含r个奇数和g个偶数. 分析: 对于区间的起点与终点,我们可以分4种情况进行讨论. 1.起点为奇数,终点为奇数,这种情况下r=g+1. 2.起点为奇数,终点为偶数,这种情况下r=g. 3.起点为偶数,终点为奇数,这种情况下r=g. 4.起点为偶数,终点为偶数,这种情况下r+1=g. 综上所述,只要满足|r - g| ≤ 1…
A. Picking&Dancing 有一列n个石子,两人交替取石子,每次只能取连续的两个,取走后,剩下的石子仍然排成1列.问最后剩下的石子数量是奇数还是偶数. 读懂题意就没什么好说的. #include<stdio.h> int n; int main() { scanf("%d",&n); if(n%2) puts("Xiaoyu_Chen"); else puts("Yitong_Qin"); return 0;…
比赛链接: http://acm.uestc.edu.cn/contest.php?cid=230 A.Police And The Thief ---UESTC 1913 简单博弈,先假设在警察先走的情况下分析,小偷先走的结果在其基础上取反面即可.我是这样做的,随便假设小偷在一个点,在这个点的四周都是必败态(警察抓不到),然后一步可以到达必败态的点都是必胜态,一次推向远处,容易发现规律: 当abs(xp-xt)%2==abs(yp-yt)%2时都是必败态,否则是必败态,这是结果已经得出. 两个…
Final Pan's prime numbers 题目连接: http://acm.uestc.edu.cn/#/problem/show/1272 题意 给你n,要求你在[4,n]范围内找到一个最大的质数x,使得x-4和x+4也是质数 题解: 数学 只有7是满足的 为什么? 1.若 n = 3x,因为n>4,所以n必为合数,不符. 2.若 n = 3x + 1, 则 n - 4 = 3x - 3 = 3(x-1) ,即(n -4 ) % 3 == 0,有且只有n=7时满足 3.若 m = 3…
宝贵资源 题目连接: http://acm.uestc.edu.cn/#/problem/show/1265 题意 平面上给n个点(n<=1000),要求找一个面积最小的正方形,将所有的点都囊括进去. 要求正方形的边必须平行于坐标轴. 题解: 对于这道题,我们可以首先找一个满足题意的,并且面积是最小的矩形. 假设矩形的长为L,宽为W,那么很显然: L = (MaxX - MinX) W = (MaxY - MinY) MaxX,MaxY 指题目中输入的最大横.纵坐标的值,MinX,MinY 指题…
链接:https://ac.nowcoder.com/acm/contest/221/C来源:牛客网 C-公式题(2) 时间限制:C/C++ 1秒,其他语言2秒 空间限制:C/C++ 32768K,其他语言65536K 64bit IO Format: %lld 题目描述 令f(n)=2*f(n-1)+3*f(n-2)+n,f(1)=1,f(2)=2 令g(n)=g(n-1)+f(n)+n*n,g(1)=2 告诉你n,输出g(n)的结果,结果对1e9+7取模 输入描述: 多组输入,每行一个整数n…
Alice and Bob Time Limit: 1000ms   Memory limit: 65536K 题目描述 Alice and Bob like playing games very much.Today, they introduce a new game. There is a polynomial like this: (a0*x^(2^0)+1) * (a1 * x^(2^1)+1)*.......*(an-1 * x^(2^(n-1))+1). Then Alice as…
点击打开链接 2226: Contest Print Server Time Limit: 1 Sec  Memory Limit: 128 MB Submit: 53  Solved: 18 [Submit][Status][Web Board] Description In ACM/ICPC on-site contests ,3 students share 1 computer,so you can print your source code any time. Here you ne…
2013年"浪潮杯"山东省第四届ACM大学生程序设计竞赛排名:http://acm.upc.edu.cn/ranklist/ 一.第J题坑爹大水题,模拟一下就行了 J:Contest Print Server [题解]: 题目大意:输入 n,s,x,y,mod  分别队伍数n,还有一个s生成函数 s=((s*x)+y)%mod,就是打印机根据要求打印纸张,打印到s时,打印机将重置,生成新的s [code]: #include <iostream> #include <…
n a^o7 ! 题目:http://acm.sdut.edu.cn/sdutoj/problem.php?action=showproblem&problemid=2413 Time Limit: 1000MS Memory limit: 65536K 题目描写叙述 All brave and intelligent fighters, next you will step into a distinctive battleground which is full of sweet and h…