![](https://img-blog.csdnimg.cn/20201014180756757.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
思维模拟
狠人王
怀着一颗热情的心,追随自己的梦想!
展开
-
【codeforce】C. Almost Equal(构造)
如何构造出第一个图?#include<bits/stdc++.h>using namespace std;typedef long long ll;const ll N=1e6;ll a[N+1000],b[N];int main(){ ll n,k=1; cin>>n; if(n&1) { for(i...原创 2019-10-25 21:03:05 · 187 阅读 · 0 评论 -
【Atcoder】D - Triangles(二分加枚举)
题意:给你几条边,问你这些边可以组成多少三角形?和这道题http://acm.hdu.edu.cn/showproblem.php?pid=4609几乎完全一样,本题数据太水哦本题数据很水,所以可以直接排序后三重循环,排序可以减少枚举次数,即只需要判断两个较小的边之和是否是小于较大边。更高效的方法是排序后只枚举前两条较小边,对第三边进行二分查找。#include <bit...原创 2019-10-20 15:19:52 · 354 阅读 · 0 评论 -
【codeforce】B. Sort the Array (翻转一次数串使得序列有序)
Being a programmer, you like arrays a lot. For your birthday, your friends have given you an arrayaconsisting ofndistinctintegers.Unfortunately, the size ofais too small. You want a bigger ar...原创 2019-08-27 15:17:41 · 228 阅读 · 0 评论 -
【codeforce】A. Nicholas and Permutation
Nicholas has an array a that contains n distinct integers from 1 to n. In other words, Nicholas has a permutation of size n.Nicholas want the minimum element (integer 1) and the maximum element (int...原创 2019-08-12 14:09:10 · 118 阅读 · 0 评论 -
【codeforce】B. Block Adventure(贪心)
Gildong is playing a video game called Block Adventure. In Block Adventure, there are n columns of blocks in a row, and the columns are numbered from 1 to n. All blocks have equal heights. The height ...原创 2019-08-12 11:20:28 · 281 阅读 · 0 评论 -
【CodeForce】A. Hotelier(思维)
Amugae has a hotel consisting of 10 rooms. The rooms are numbered from 0 to 9from left to right.The hotel has two entrances — one from the left end, and another from the right end. When a customer a...原创 2019-08-12 10:24:34 · 345 阅读 · 0 评论 -
【AtCoder】D - Summer Vacation(STL优先队列)
Problem StatementThere are None-off jobs available. If you take the i-th job and complete it, you will earn the reward of Bi after Aidays from the day you do it.You can take and complete at most o...原创 2019-08-11 19:11:38 · 346 阅读 · 0 评论 -
【CodeForces】 - 259B (幻方规律)(水)
Little Elephant loves magic squares very much.Amagic squareis a3 × 3table, each cell contains some positive integer. At that the sums of integers in all rows, columns and diagonals of the table ...原创 2019-08-20 08:47:59 · 185 阅读 · 0 评论 -
【codeforce】A. Circle of Students(思维)
There arennstudents standing in a circle in some order. The index of theii-th student ispipi. It is guaranteed that all indices of students are distinct integers from11tonn(i. e. they form a p...原创 2019-08-14 09:23:06 · 221 阅读 · 0 评论 -
【codeforce】C. Maximum Median(规律)
DescriptionYou are given an array a of n integers, where nis odd. You can make the following operation with it:Choose one of the elements of the array (for example ai) and increase it by 1 (that is...原创 2019-08-09 14:56:57 · 608 阅读 · 0 评论 -
【codeforce】A. Thanos Sort(递归)
time limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputThanos sort is a supervillain sorting algorithm, which works as follows: if the array is no...原创 2019-07-28 21:27:55 · 216 阅读 · 0 评论 -
【codeforce】1200C - Round Corridor
Amugae is in a very large round corridor. The corridor consists of two areas. The inner area is equally divided by n sectors, and the outer area is equally divided by msectors. A wall exists between ...原创 2019-08-12 14:35:57 · 223 阅读 · 0 评论 -
【UVA】 - 11827 Maximum GCD (注意读入)
Given the N integers, you have to find the maximum GCD (greatest common divisor) of every possible pair of these integers.InputThe first line of input is an integer N (1 < N < 100) that determine...原创 2019-08-16 21:27:16 · 100 阅读 · 0 评论 -
【Comet OJ】 - Contest #9 & X Round 3 【XR-3】小道消息
描述小 X 想探究小道消息传播的速度有多快,于是他做了一个社会实验。有n 个人,其中第i个人的衣服上有一个数i+1。小 X 发现了一个规律:当一个衣服上的数为i的人在某一天知道了一条信息,他会在第二天把这条信息告诉衣服上的数为j的人,其中 gcd(i,j)=1gcd(i,j)=1(即i,j 的最大公约数为11)。在第 0天,小 X 把一条小道消息告诉了第k个人,小 X 想...原创 2019-08-26 22:23:15 · 202 阅读 · 0 评论 -
Comet OJ - Contest #10(构造)
胖头鱼在苦恼“沉鱼落雁”是什么好吃的东西,这很显然是因为他成语没背够。于是他决定开始背成语。胖头鱼身为鱼界大佬,背成语的姿势自然也和常人不一:他会先将所有要背的成语一字排开,比较难背的成语会重复出现,最多重复33次 (也就是出现次数可能为11,22或33)。这样就得到了一个可能有重复元素的成语序列,然后他会将这个序列打乱顺序,并按打乱后的顺序背下去。为了均匀的背所有成语,...原创 2019-09-19 16:45:36 · 109 阅读 · 0 评论 -
2019icpc上海网络赛 Digit sum(预处理)(数位dp)
https://nanti.jisuanke.com/t/41422题意:直接看图,简单明了分析:这个我觉得有必要从时间复杂度层面分析这道题目。首先如果是无脑采取暴力的做法,时间复杂度是O(1e5*1e6),必然超时,做都不用做,肯定要换算法或者优化。我们可以观察到本题有T(100000)种case,如果我们每次case都要对N这么大的范围进行暴力操作查找,那么肯定是会超时的,所以...原创 2019-09-17 22:15:56 · 253 阅读 · 0 评论 -
【CodeForces】 1201B B - Zero Array(思维)
You are given an arraya1,a2,…,an.In one operation you can choose two elementsaiaiandajaj(i≠ji≠j) and decrease each of them by one.You need to check whether it is possible to make all the elem...原创 2019-09-14 19:05:11 · 191 阅读 · 0 评论 -
【codeforce】A. There Are Two Types Of Burgers(贪心)
https://codeforces.com/contest/1207/problem/A#include<bits/stdc++.h>#define ll long longusing namespace std;ll n,x,ans;int main(void){ int T,b,p,f,h,c; cin>>T; int cnt1=...原创 2019-09-09 20:04:21 · 144 阅读 · 0 评论 -
【51nod】2651 区间和的和
输入一个长度为n的数组a,a包括(n+1)n/2个区间。每个区间所有数的和,被称为区间和,求所有(n+1)n/2个区间和的和。由于数值较大,输出mod 1e9+7的结果。例如:3个数1 2 3,共有6个子区间,包含的数字如下:{1} {2} {3} {1 2} {2 3} {1 2 3},这些区间求和为1 2 3 3 5 6,这6个数字再求和为20.收起输入第一行一个整...原创 2019-09-09 19:30:39 · 839 阅读 · 0 评论 -
【CodeForces】 - 279E(贪心|DP)
Valera considers a numberbeautiful, if it equals2kor -2kfor some integerk(k ≥ 0). Recently, the math teacher asked Valera to represent numbernas the sum of beautiful numbers. As Valera is real...原创 2019-09-05 21:57:19 · 261 阅读 · 0 评论 -
【CodeForces】思维,选择问题
The Bitlandians are quite weird people. They have very peculiar customs.As is customary, Uncle J. wants to haveneggs painted for Bitruz (an ancient Bitland festival). He has asked G. and A. to do ...原创 2019-09-05 21:43:44 · 271 阅读 · 0 评论 -
【codeforce】A. Chips Moving(规律)(~水)
You are givennnchips on a number line. Theii-th chip is placed at the integer coordinatexixi. Some chipscan have equal coordinates.You can perform each of the two following types of moves any (...原创 2019-09-04 08:38:00 · 321 阅读 · 0 评论 -
CCPC-Wannafly & Comet OJ 夏季欢乐赛(2019)距离产生美
题目描述JWJU放暑假了,于是鸡尾酒就和女朋友璇璇一起出去玩。但是外面太热了,只要他们牵牵手就会手心出汗。鸡尾酒觉得在这些热的地方就应该保持距离,不然就实在热的受不了了!现在鸡尾酒获得了一个长度为n的数组,且第i个元素为aia_{i}ai这个数组他看着都热——相邻两个元素实在太接近了。他觉得对于任意的 i(1<i≤n)i(1 < i \le n)i(1<i≤n),都必须满...原创 2019-07-28 19:58:45 · 150 阅读 · 0 评论 -
CCPC-Wannafly & Comet OJ 夏季欢乐赛(2019)
题目描述:据说每一个走进Gree哥哥心房的小姑娘都没有能够再走出来……我们将Gree哥哥的心房抽象成一个n×mn \times mn×m的地图,初始所有点均为空。当小姑娘走入他的心房时(此时小姑娘的位置为 (1,1)(1,1)(1,1) 点),他会将kkk 个 1×11 \times 11×1 障碍物放入地图来阻止小姑娘的行动,每个位置最多只能放置一个障碍物(即不能叠加放置)。但由于Gree哥...原创 2019-07-28 19:50:49 · 123 阅读 · 0 评论 -
CodeForces - 236B(水,因子)
Let’s denote d(n) as the number of divisors of a positive integer n. You are given three integers a, b and c. Your task is to calculate the following sum:Find the sum modulo 1073741824 (230).InputT...原创 2019-08-01 21:19:10 · 223 阅读 · 0 评论 -
【Codeforces】 Round #512 (Div. 2)B. Vasya and Cornfied
Vasya owns a cornfield which can be defined with two integers nn and dd. The cornfield can be represented as rectangle with vertices having Cartesian coordinates (0,d),(d,0),(n,n−d)(0,d),(d,0),(n,n−d)...原创 2019-05-24 10:47:32 · 156 阅读 · 0 评论 -
CodeForce1058A
When preparing a tournament, Codeforces coordinators try treir best to make the first problem as easy as possible. This time the coordinator had chosen some problem and asked nn people about their opi...原创 2019-05-23 21:09:02 · 440 阅读 · 0 评论 -
CodeForce1047B
There are nn points on the plane, (x1,y1),(x2,y2),…,(xn,yn)(x1,y1),(x2,y2),…,(xn,yn).You need to place an isosceles triangle with two sides on the coordinate axis to cover all points (a point is cove...原创 2019-05-23 20:53:17 · 131 阅读 · 0 评论 -
CodeForce1047A
Little C loves number «3» very much. He loves all things about it.Now he has a positive integer nn. He wants to split nn into 33 positive integers a,b,ca,b,c, such that a+b+c=na+b+c=n and none of the...原创 2019-05-23 19:53:06 · 149 阅读 · 0 评论 -
P3864命名那个数字
题目描述在威斯康辛州牛守志大农场经营者之中,都习惯于请会计部门用连续数字给母牛打上烙印。但是,母牛本身并没感到这个系统的便利,它们更喜欢用它们喜欢的名字来呼叫它们的同伴,而不是用像这个的语句"C’mon, #4364, get along."。请写一个程序来帮助可怜的牧牛工将一只母牛的烙印编号翻译成一个可能的名字。因为母牛们现在都有手机了,使用标准的按键的排布来把将数目翻译为文字:( 除了 “Q...原创 2019-05-21 16:16:50 · 119 阅读 · 0 评论 -
tle代码
#include<iostream>#include<string>#include<cstring>using namespace std;typedef long long ll;int n,k=1,p=0,maxn=-22222222;string s;int main(){ cin>>n; cin>&...原创 2019-05-21 15:14:32 · 907 阅读 · 0 评论 -
第十届山东省赛A题
CalandarTime Limit: 1 Second Memory Limit: 65536 KBOn a planet far away from Earth, one year is composed of 12 months, and each month always consists of 30 days.Also on that planet, there are ...原创 2019-05-20 13:08:03 · 198 阅读 · 0 评论 -
第十届山东省赛 M题
Sekiro: Shadows Die Twice is an action-adventure video game developed by FromSoftware and published by Activision. In the game, the players act as a Sengoku period shinobi known as Wolf as he attempts...原创 2019-05-19 23:41:01 · 202 阅读 · 0 评论 -
CodeForce--1165B polycarp training
Polycarp wants to train before another programming competition. During the first day of his training he should solve exactly 11 problem, during the second day — exactly 22 problems, during the third d...原创 2019-05-19 16:24:46 · 430 阅读 · 0 评论 -
Codeforce 3B. Amr and The Large Array
Amr has got a large array of size n. Amr doesn’t like large arrays so he intends to make it smaller.Amr doesn’t care about anything in the array except the beauty of it. The beauty of the array is de...原创 2019-05-29 12:24:53 · 187 阅读 · 0 评论 -
CodeForces-231D Problem C(思维,几何数学)
One day Vasya was going home when he saw a box lying on the road. The box can be represented as a rectangular parallelepiped. Vasya needed no time to realize that the box is special, as all its edges ...原创 2019-07-30 16:03:44 · 117 阅读 · 0 评论 -
Poj 3210 Coins(思维)(矛盾推理)
题目意思是掷硬币,要求最少掷多少次能使全部硬币朝向一致。分析:当硬币个数是偶数时,硬币面有两种情况,一种正面为偶数个,反面是偶数个,另一种是正面奇数个,反面奇数个。第一种情况最少掷偶数次,第二种情况最少掷奇数次,二者矛盾,所以该情况下输出no solution。当硬币个数是奇数时,情况是奇数个正面,偶数个反面,反之也成立。在这种情况下最少情况就是翻转一次,但是满足情况的最小的只有n-1#i...原创 2019-08-03 16:09:49 · 193 阅读 · 0 评论 -
LightOJ - 1136 Division by 3(思维)(找规律)
There is sequence 1, 12, 123, 1234, …, 12345678910, … . Now you are given two integers A and B, you have to find the number of integers from Ath number to Bth (inclusive) number, which are divisible b...原创 2019-08-01 16:38:45 · 393 阅读 · 0 评论 -
LightOJ Circle in Square (简单计算几何)
A circle is placed perfectly into a square. The term perfectly placed means that each side of the square is touched by the circle, but the circle doesn’t have any overlapping part with the square. See...原创 2019-08-01 15:52:35 · 277 阅读 · 0 评论 -
CodeForce 222B 思维,易超时
The Free Meteor Association (FMA) has got a problem: as meteors are moving, the Universal Cosmic Descriptive Humorous Program (UCDHP) needs to add a special module that would analyze this movement.UC...原创 2019-07-27 15:52:04 · 398 阅读 · 0 评论