CodeForces 680A&680B&680C&680D Round#356】的更多相关文章

昨天晚上实在是=_=困...(浪了一天)就没有去打Codeforces 中午醒来看看题,还不太难. A题:模拟(水题 3minAC) // by Sirius_Ren #include <cstdio> #include <cstring> #include <algorithm> using namespace std; int a[6],sum=0,ans; bool cmp(int a,int b){return a>b;} int main() { for…
B. Bear and Finding Criminals 链接:http://codeforces.com/contest/680/problem/B There are n cities in Bearland, numbered 1 through n. Cities are arranged in one long row. The distance between cities i and j is equal to |i - j|. Limak is a police officer…
A. Bear and Five Cards 题目链接:http://codeforces.com/contest/680/problem/A A little bear Limak plays a game. He has five cards. There is one number written on each card. Each number is a positive integer. Limak can discard (throw out) some cards. His go…
C. Bear and Prime 100 time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output This is an interactive problem. In the output section below you will see the information about flushing the output. Bea…
B. Bear and Finding Criminals time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output There are n cities in Bearland, numbered 1 through n. Cities are arranged in one long row. The distance betwee…
A. Bear and Five Cards time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output A little bear Limak plays a game. He has five cards. There is one number written on each card. Each number is a posit…
http://codeforces.com/contest/680/problem/E 题目大意:给你一个n*n的图,然后图上的 . (我们下面都叫做‘点’)表示可以走,X表示不能走,你有如下的操作,每次你可以选择一个k*k的框,把其中的所有的X都变成 ‘点’,问在该操作后点相连的数目最多是多少? 没看别人代码和思路自己思考并优化了好久,于是敲了两个多小时...还是代码能力太差了 思路:当然最最单纯的做法就是O(n^4).为了优化,起初想用二维树状数组+并查集的,结果发现窗口中的‘点‘’容易造成…
http://codeforces.com/contest/680/problem/D 题目大意:给你一个大小为X的空间(X<=m),在该空间内,我们要尽量的放一个体积为a*a*a的立方体,且每次放入的立方体的体积要尽可能大,问最多能放几块? 感觉自己还是太菜了...这种题目都做不来TAT 思路:因为每次都要放入,我们找一下情况以后可以发现,假设当前的体积为x,如果要让cnt个数最多,要么就是要减去x-a*a*a,要么就是让x直接等于a*a*a-1,因此我们很容易就可以得到这是一个dfs的条件,…
D. Bear and Chase 题目连接: http://codeforces.com/contest/679/problem/D Description Bearland has n cities, numbered 1 through n. There are m bidirectional roads. The i-th road connects two distinct cities ai and bi. No two roads connect the same pair of…
E. Bear and Square Grid 题目连接: http://www.codeforces.com/contest/680/problem/E Description You have a grid with n rows and n columns. Each cell is either empty (denoted by '.') or blocked (denoted by 'X'). Two empty cells are directly connected if the…
D. Bear and Tower of Cubes 题目连接: http://www.codeforces.com/contest/680/problem/D Description Limak is a little polar bear. He plays by building towers from blocks. Every block is a cube with positive integer length of side. Limak has infinitely many…
C. Bear and Prime 100 题目连接: http://www.codeforces.com/contest/680/problem/C Description This is an interactive problem. In the output section below you will see the information about flushing the output. Bear Limak thinks of some hidden number - an i…
B. Bear and Finding Criminals 题目连接: http://www.codeforces.com/contest/680/problem/B Description There are n cities in Bearland, numbered 1 through n. Cities are arranged in one long row. The distance between cities i and j is equal to |i - j|. Limak…
A. Bear and Five Cards 题目连接: http://www.codeforces.com/contest/680/problem/A Description A little bear Limak plays a game. He has five cards. There is one number written on each card. Each number is a positive integer. Limak can discard (throw out) s…
A. Bear and Five Cards time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output A little bear Limak plays a game. He has five cards. There is one number written on each card. Each number is a posit…
C. Bear and Square Grid time limit per test 3 seconds memory limit per test 256 megabytes input standard input output standard output You have a grid with n rows and n columns. Each cell is either empty (denoted by '.') or blocked (denoted by 'X'). T…
C. Bear and Prime 100 time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output This is an interactive problem. In the output section below you will see the information about flushing the output. Bea…
题目链接: B. Problems for Round time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output There are n problems prepared for the next Codeforces round. They are arranged in ascending order by their diffi…
题目链接:  http://codeforces.com/contest/335/problem/B 分析: 第一眼看上去串的长度为5*10^4, 冒似只能用O(n)的算法可解. 而这样的算法从来没见过...... 其实不然, 注意一个条件"如果有存在长度为100的回文子串则输出长度为100的,否则输出最长的", 可以发现: 一个长度大于100的回文串都可以变成长度为100的 如: 长度为101的只要删除中间的一个就变为长度为100的, 长度为102的删除中间两个也变为长度为100的.…
https://codeforces.com/contest/1056/problem/B 题意:输入n,m    求((a*a)+(b*b))%m==0的(a,b)种数(1<=a,b<=n) (n<=1e9,m<=1000) 题解:由于a,b的数量级很大,而m的数量级很小,又因为求((a*a)+(b*b))%m==0,即求((a%m*a%m)+(b%m*b%m))%m==0满足要求的a,b对数,也就是求a%m,b%m的平方分别取模后相加为0或者m的a,b对数,由于此时问题只和a%…
http://codeforces.com/contest/1054/problem/D 题目大意:一个序列a1 a2...an,可以对若干个元素进行取反,使所得的新序列异或和为0的区间个数最多. 题目分析:首先易知每个位置的前缀异或和的值只有两种,因为对元素进行取反时,取偶数个元素异或和不变,奇数个元素就是原值取反.然后由于对一个位置取反,不会影响后面位置与这个位置的前缀异或和相同的位置个数(因为这个位置取反后,后面各个位置的前缀异或和也跟着改变),所以一个位置的改变只会影响与前面位置前缀和相…
B. Photo to Remember Time Limit: 1 Sec  Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/522/problem/B Description One day n friends met at a party, they hadn't seen each other for a long time and so they decided to make a group photo together…
传送门 Description You are given names of two days of the week. Please, determine whether it is possible that during some non-leap year the first day of some month was equal to the first day of the week you are given, while the first day of the next mon…
传送门 Description You are given a table consisting of n rows and m columns. Numbers in each row form a permutation of integers from 1 to m. You are allowed to pick two elements in one row and swap them, but no more than once for each row. Also, no more…
题目链接: A. Bear and Five Cards //#include <bits/stdc++.h> #include <vector> #include <iostream> #include <queue> #include <cmath> #include <map> #include <cstring> #include <algorithm> #include <cstdio>…
这两天回家了 家里电脑太卡 调试不方便 就只能写写水题了…… #include<stdio.h> #include<iostream> #include<algorithm> #include<math.h> #include<string.h> #include<string> #include<map> #include<set> #include<vector> #include<que…
D. Closest Equals Time Limit: 1 Sec  Memory Limit: 256 MB 题目连接 http://www.lydsy.com/JudgeOnline/problem.php?id=3224 Description You are given sequence a1, a2, ..., an and m queries lj, rj (1 ≤ lj ≤ rj ≤ n). For each query you need to print the minimu…
1146C Tree Diameter 题意 交互题.有一棵 \(n(n\le 100)\) 个点的树,你可以进行不超过 \(9\) 次询问,每次询问两个点集中两个不在同一点集的点的最大距离.求树的直径. 题解 和 GXOI2019旅行者 基本类似,二进制分组,对于每一位,编号当前位为 \(0\) 的分到一组,当前位为 \(1\) 的分到另一组.最大询问次数为 \(\log 100 = 7\) code #include<cstdio> int v1[105],v2[105]; int mai…
今天D哥给我提了个问题,"用php执行过js没"?咋一听,没戏~~毕竟常规情况下,js是依赖浏览器运行的.想在php后端采集的同时利用js运行结果并传递给php使用,没戏! 然后回头一想,要是换成nodejs呢?利用nodejs作为解析js的服务器,然后php请求nodejs运行结果,岂不是能够变相实现php调取js执行的结果? 说干就干,nodejs只是初步涉猎,要想实现想法,需要: 利用nodejs搭建一个http服务 nodejs能够接收传入参数 nodejs能够正确运行相应前端…
直接上代码 1,js(2个文件,网上找的)  不要觉的长,直接复制下来就OK //UnicodeAnsi.js文件 //把Unicode转成Ansi和把Ansi转换成Unicode function UnicodeChr() { return '00A4,00A7,00A8,00B0,00B1,00B7,00D7,00E0,00E1,00E8,00E9,00EA,00EC,00ED,00F2,00F3,00F7,00F9,00FA,00FC,0101,0113,011B,012B,014D,01…