【CodeforcesRound#277.5(Div.2)(C题)_html/css_WEB-ITnose】教程文章相关的互联网学习教程文章

CodeforcesRound#261(Div.2)[ABCDE]_html/css_WEB-ITnose

Codeforces Round #261 (Div. 2)[ABCDE] ACM 题目地址:Codeforces Round #261 (Div. 2) A - Pashmak and Garden 题意: 一个正方形,它的边平行于坐标轴,给出这个正方形的两个点,求出另外两个点。 分析: 判断下是否平行X轴或平行Y轴,各种if。 代码: /** Author: illuz <iilluzen[at]gmail.com>* File: A.cpp* Create Date: 2014-08-15 23:35:17* Descripton: */#include #include #i...

CodeforcesRound#262(Div.2)460B.LittleDimaandEquation(枚举)_html/css_WEB-ITnose

题目链接:http://codeforces.com/problemset/problem/460/B B. Little Dima and Equation time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Little Dima misbehaved during a math lesson a lot and the nasty teacher Mr. Pickles gave him the following prob...

CodeforcesRound#262(Div.2)解题报告_html/css_WEB-ITnose

详见:http://robotcator.logdown.com/posts/221514-codeforces-round-262-div-2 1:A. Vasya and Socks http://codeforces.com/contest/460/problem/A 有n双袜子,每天穿一双然后扔掉,每隔m天买一双新袜子,问最多少天后没有袜子穿。。 简单思维题:以前不注重这方面的训练,结果做了比较久,这种题自己边模拟边想。不过要多考虑trick ```c++ int main(){ int n, m; long long ans = 0; scanf("%d%d", &n, ...

CodeforcesRound#262(Div.2)A,B,C_html/css_WEB-ITnose

A. Vasya and Socks time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Vasya has n pairs of socks. In the morning of each day Vasya has to pu...

CodeforcesRound#256(Div.2)A/B/C/D_html/css_WEB-ITnose

A. Rewards 水题 #include#include#includeusing namespace std;int main(){ int a1,a2,a3,b1,b2,b3,s,t1,t2,sum1,sum2; while(scanf("%d%d%d",&a1,&a2,&a3)!=EOF) { scanf("%d%d%d",&b1,&b2,&b3); scanf("%d",&s); sum1 = a1+a2+a3; sum2 = b1+b2+b3; if(sum1>=5) { t1 = sum1/5; if(sum1%5) t1++; } else if(sum1>0) t1 = 1; ...

CodeforcesRound#261(Div.2)A.PashmakandGarden_html/css_WEB-ITnose

A. Pashmak and Garden time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Pashmak has fallen in love with an attractive girl called Parmida s...

CodeforcesRound#262(Div.2)C_html/css_WEB-ITnose

题目: C. Present time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Little beaver is a beginner programmer, so informatics is his favorite subject. Soon his informatics teacher is going to have a birthday and the beaver h...

CodeforcesRound#262(Div.2)-A,B,C,D_html/css_WEB-ITnose

A. Vasya and Socks 水题就不用多说了,直接暴力枚举就完事了。 #include #include#include#include#include#include#includeusing namespace std;#define LL __int64int main(){ int n,k; while(~scanf("%d%d",&n,&k)) { int m=n; int ans=n; int yu=0; while(m) { m=m+yu; yu=m%k; m=m/k; ans+=m; } cout< B. Lit...

CodeforcesRound#263(Div.2)_html/css_WEB-ITnose

462 A 题意读懂后就好做了,就是与一个方块上下左右相邻的‘o’的个数,如果是偶数,yes,否则,no。 #include#include#include#include#include#include#include#include#include#define pi acos(-1.0)#define inf 0xfffffff#define maxn 5000using namespace std;char str[maxn][maxn];int a[maxn],b[maxn];int main(){ int n; scanf("%d",&n); for(int i=0;i<n;i++) scanf("%s",str[i]); for(int i=0;i<...

CodeforcesRound#263(Div.1)-A,B,C_html/css_WEB-ITnose

A: 这道题目还是很简单的,做过很多遍了,类似于切割木板的问题。 把所有的数放在一个优先队列里,弹出两个最大的,然后合并,把结果放进去。依次进行。 #include #include#include#include#include#include#include#includeusing namespace std;#define LL __int64#define INF 1000000000LL a[330000];priority_queueque;int main(){ int n; while(~scanf("%d",&n)) { LL sum=0; while(!que.empty()...

CodeforcesRound#250(Div.1)D线段树_html/css_WEB-ITnose

看看type = 2的操作,对于区间[l,r]内的元素对x取模,由于取模肯定不能和取模,所以只能每个元素取模,看上去不是区间更新,但是仔细一看,若区间[l,r]内所有的元素都小于x,那么这一区间不需要管,所以还是存在区间整段操作,所以需要lazy,这里也算是一个剪枝了,剩下的就是type = 3的 单点更新,还有type = 1的区间求和,整体操作不难 int n,m;ll nnum[100000 + 55];typedef struct Node { int l,r; ll sum; ll maxn;};Node...

CodeforcesRound#264(Div.2)_html/css_WEB-ITnose

Codeforces Round #264 (Div. 2) 题目链接 A:注意特判正好的情况,其他就一个个去判断记录最大值即可 B:扫一遍,不够的用钱去填即可,把多余能量记录下来 C:把主副对角线处理出来,然后黑格白格只能各选一个最大的放即可 D:转化为DAG最长路问题,每个数字记录下在每个序列的位置,如果一个数字能放上去,那么肯定是每个序列上的数字都是在之前最末尾数字的后面 E:大力出奇迹,预处理出树,然后每次查询从当前位置...

CodeforcesRound#265(Div.2)_html/css_WEB-ITnose

Codeforces Round #265 (Div. 2) 题目链接 A:把数字变换后比较一下几个不一样即可 B:连续2个以上0当作一次操作,开头的0和结尾的0可以忽略 C:贪心从末尾去构造,由于保证一开始是回文,所以保证修改后出现回文只可能为长度2或3的,这样的话判断复杂度就很小了 D:暴力枚举情况,然后判断 E:把操作逆过来处理出每个数字对应的位数和相应数字,然后在for一遍计算答案即可 代码: A: #include #include int ...

CodeforcesRound#263(Div.1)ABC_html/css_WEB-ITnose

Codeforces Round #263 (Div. 1) A:贪心,排个序,然后从后往前扫一遍,计算后缀和,之后在从左往右扫一遍计算答案 B:树形DP,0表示没有1,1表示有1,0遇到0必然合并,0遇到1也必然合并,1遇到0必然合并,1遇到1,必然切断,按照这样去转移即可 C:树状数组,再利用启发式合并,开一个l,r记录当前被子左右下标,和一个flip表示是否翻转 代码: A: #include #include #include #include #include using namespace ...

CodeforcesRound#FF(Div.2)E(线段树成段更新)_html/css_WEB-ITnose

C. DZY Loves Fibonacci Numbers time limit per test 4 seconds memory limit per test 256 megabytes input standard input output standard output In mathematical terms, the sequence Fn of Fibonacci numbers is defined by the recurrence relation F1?=?1; F2?=?1; Fn?=?Fn?-?1?+?Fn?-?2 (n?>?2). DZY l...