CodeForces
ID_BePosit
如果今天不比昨天多做一点什么,那么明天还有什么意义。
展开
-
A - Kyoya and Photobooks(个人赛 Round 3)
对错一念之间错的:#include<bits/stdc++.h>using namespace std;int tong [30]= {0};int main(){ string str; cin>>str; int ans=str.size(),sum=0; for(int i=0; i<ans; i++) ...原创 2018-07-31 11:13:15 · 159 阅读 · 0 评论 -
A - Sonya and Hotels-coordinate(坐标)
A - Sonya and Hotels CodeForces - 1004A:题意:新建酒店不能再两个原来酒店的范围内,#include<bits/stdc++.h>using namespace std;#define maxn 105int a[maxn];int main(){ int n,d,ans=2; cin>>n>...原创 2018-08-13 18:59:22 · 177 阅读 · 0 评论 -
B - Sonya and Exhibition-思维题
只要保证间隔着放0.1两种花就能得到。任意两个区间内的乘积最大。 #include<bits/stdc++.h>using namespace std;int main(){ int n,m,u,v; cin>>n>>m; while(m--) { cin>>u>>v;...原创 2018-08-13 19:01:47 · 158 阅读 · 0 评论 -
B - Black and White -构造. Black and White
#include<bits/stdc++.h>using namespace std;# define inf 0x3f3f3f3f3f# define maxn 10001pair<int,int >q[maxn];char a[1500][100];int main(){ freopen("black.in","r",stdin); fr...原创 2018-08-13 19:06:55 · 662 阅读 · 0 评论 -
B - Aesthetics in poetry
B - Aesthetics in poetry Gym - 101879B 题意:N个数 找一个n的因数k然后 这n个数取余k得到n-1种结果。另一个要求是这n种取余结果出现的次数得=n/k。. We say that the poem is KK-elegant if K>1K>1, NN is a multiple of KK and, moreover, t...原创 2018-08-28 19:04:52 · 232 阅读 · 0 评论 -
A - Killer Problem-分层累加
A - Killer Problem UVA - 11898 You are given an array of N integers and Q queries. Each query is a closed interval [l, r]. You should find the minimum absolute difference between all pairs in ...原创 2018-08-28 19:38:23 · 172 阅读 · 0 评论 -
G - WiFi Password- | 运算-倒尺取法
G - WiFi Password Gym - 101608G 题意: 求一个最长的|运算不超过v的连续序列 尺取法 碰到不行往回倒 #include<bits/stdc++.h>using namespace std;#define maxn 100050long long t,n,m,v,a[maxn];long long r,ans,sum,j...原创 2018-09-01 11:01:20 · 215 阅读 · 0 评论 -
A - Doggo Recoloring-思维
#include<bits/stdc++.h>using namespace std;int len,a[30];string str;int main(){ cin>>len>>str; for(int i=0; i<len; i++) a[str[i]-'a']++; if(len==1||a[max...原创 2018-09-04 15:39:31 · 211 阅读 · 0 评论 -
B - Alyona and Numbers -思维
B - Alyona and Numbers CodeForces - 682A 两个数组取模 用桶标记即可#include<bits/stdc++.h>#define ll long long#define maxn 11using namespace std;ll book[maxn],n,m,sum;int main(){ cin>>...原创 2018-09-30 17:43:54 · 184 阅读 · 0 评论 -
A - About Bacteria -换个角度看问题
A - About Bacteria CodeForces - 199C 两个实验按照公式分裂 第一个实验已知产生总量sum值 问第二个实验合适能够产生sum需要多少天 直接跑肯定超时的啊 所以看一下第一个实验何时能够产生第二个实验的初始量所需要的天数 用n减去即可 #include<bits/stdc++.h>using namespace std...原创 2018-09-30 17:48:50 · 330 阅读 · 0 评论 -
Prefixes and Suffixes-DIV3
Prefixes and Suffixes 题意:一个长度为n的字符串,给出 2n-2个前缀和后缀。打乱顺序的,然后让你输出这2n-2的分别是前缀还是后缀。 思路:找到两个最长的,两种构造方式选一个放在前面另一个的最后一个字母加上即可。然后进行这两种构造原串的 方式哪一种成立即可,输出任意一个成立的,注意验证时只要调用FIND函数查找,子串位置时候是0即可,有可能有些前后缀 相同的情况,加...原创 2018-12-19 15:23:54 · 323 阅读 · 0 评论 -
F - Tree with Maximum Cost-裸换根DP
Tree with Maximum Cost 题意:无向图一棵树,有N个点。每个点有一个权值,相邻两点距离为1,求一个最大节点值。 定义为emmmmm据说是换根Dp #include<bits/stdc++.h>using namespace std;#define maxn 234567#define ll long longll n,a[maxn],deep[m...原创 2018-12-19 15:28:57 · 242 阅读 · 0 评论 -
D1. Great Vova Wall (Version 1)-匹配栈
Great Vova Wall (Version 1) emmm只要相邻两个奇偶性相同即可能够通过2的倍数来补齐差距然后通过一起填1到达任意高度。 所以就这样进行匹配,如最终栈内只有一个或0个即为合法情况。 #include<bits/stdc++.h>using namespace std;#define maxn 234567int n,a[maxn];int ...原创 2018-12-19 19:23:22 · 239 阅读 · 0 评论 -
Masha and two friends-矩形相交-容斥
Masha and two friends 题意:先给出一个n行m列的矩阵,这个矩阵是黑白交错的,左下角是白的,然后再给出一个矩阵。 这个矩阵就全部染成白色的,之后再给出一个矩阵,这个矩阵染成黑色的,数据范围是1e9。 问最后白色块和黑色块分别由多少? 坐标系中两矩形相交条件为: min(xa2,xb2)>=max(xa1,xb1)&&min(ya2,yb2)>...原创 2018-12-23 10:59:25 · 310 阅读 · 0 评论 -
Powers Of Two-思维
Powers Of Two 题意 : 问能否把 n分解成 k个 2 的次幂 的和 思路:优先队列维护 分成的 数,如果数目<k 取出最大的继续分解。控制好终止条件即可。 当 个数>k ,或者 小于 k 并且全为1了不能再分解了 停止输出NO,恰好为 K 停止输出即可 。 #include<bits/stdc++.h>using namespace std...原创 2018-12-28 17:25:00 · 562 阅读 · 0 评论 -
A - Fried Fish -最大利用-
A. Fried Fish 题意: N 条鱼要煎熟,每次煎鱼锅中只能煎 K 条鱼的一面(一条鱼要煎两面) ceil 向上取整、 #include <bits/stdc++.h> using namespace std; int main(){ double n,m; while(cin>>n>>m){ ...原创 2018-08-15 19:01:41 · 294 阅读 · 0 评论 -
C - Less or Equal CodeForces - 977C
C - Less or Equal CodeForces - 977C 特判特判。 #include<iostream>#include<bits/stdc++.h>using namespace std;#define man 250000int a[man];int main(){ int n,k,ans=-1; cin>...原创 2018-08-08 08:55:10 · 212 阅读 · 0 评论 -
A - Codehorses T-shirts (仔细读题)
A - Codehorses T-shirts CodeForces - 1000A题目大意: 根据题目要求要么不需要改要么只需要改动一个字母。 so now Ksenia is required not to write the whole list from the scratch (擦去)but just(只能这样做) make some changes to the li...原创 2018-08-12 16:27:30 · 641 阅读 · 0 评论 -
B - Ohana Cleans Up (个人赛 Round 3)
B - Ohana Cleans Up CodeForces - 554B 错误:自以为擦掉0多的列就ok了。#include<bits/stdc++.h>using namespace std;int colum[105]={0};int main(){ char str[105][105],str1[105][105]; int n,sum;...原创 2018-07-31 11:15:27 · 155 阅读 · 0 评论 -
A - Row - 982A (新定义seat)
A - Row CodeForces - 982A #include <bits/stdc++.h>using namespace std;int main(){ string str,temp; int n; cin>>n>>str; temp="11"; if(str.find(temp)!...原创 2018-08-09 15:38:52 · 1329 阅读 · 0 评论 -
F - G UVALive - 7454 (栈应用)
F - G UVALive - 7454 #include <iostream>#include <bits/stdc++.h>using namespace std;int main(){ int n,t,ans; char s[105]; stack<char>stk; cin>>t; w...原创 2018-08-05 16:38:30 · 156 阅读 · 0 评论 -
D - Single-use Stones -(思维-frog过河)
D - Single-use Stones CodeForces - 965D 在L段上求最小值更新最小值#include<bits/stdc++.h>using namespace std;typedef long long ll;ll n,l;ll a[100005];ll sum[100005];int main(){ ios::sy...原创 2018-08-10 10:55:47 · 259 阅读 · 0 评论 -
C - Three Parts of the Array -(数组左-右搜索)
#include<bits/stdc++.h>using namespace std;#define maxn 20005long long pre,post,ans=0;int a[maxn],n;int main(){ cin>>n; for(int i=0; i<n; i++) cin>>a[i]; ...原创 2018-08-06 10:22:20 · 269 阅读 · 0 评论 -
Summer Individual - 17 -A
A permutation is a sequence of integers p1, p2, ..., pn, consisting of n distinct positive integers, each of them doesn't exceed n. Let's denote the i-th element of permutation p as pi. We'll call num...原创 2018-08-01 17:57:05 · 195 阅读 · 0 评论 -
B - Blown Garland -思维
B - Blown Garland CodeForces - 758B Nothing is eternal in the world if you take any four consecutive light bulbs then there will not be light bulbs with the same color among them. 仔细分析后...原创 2018-08-14 15:53:36 · 189 阅读 · 0 评论 -
Summer Individualt- 18 - A - Window
A - Window Gym - 101020AAnas" is a good citizen(好公民) lives in "Lateria". Lateria is a city full of naughty (粗俗顽皮的)children, you can not sleep, eat nor relax! -poor Anas-. Anas is my friend and kno...原创 2018-08-02 14:38:24 · 275 阅读 · 0 评论 -
B - Paper Game Gym -
B - Paper Game Gym - 101020B 题目大意 :找好切分次数与给定尺寸的关系就可确定是谁赢 #include<bits/stdc++.h>using namespace std;int main(){ int t,n,m; cin>>t; while(t--) { cin&...原创 2018-08-02 14:40:33 · 321 阅读 · 0 评论 -
C - Rectangles (x-y坐标轴与二维数组)
C - Rectangles Gym - 101020C 注意数组下标与坐标轴上小方块的面积的关系统一x,y 减去 1#include<bits/stdc++.h>using namespace std;int mmp[105][105];int main(){ int t,x,y,z,n,ans; cin>>t; w...原创 2018-08-02 14:43:06 · 1227 阅读 · 0 评论 -
J - Good Coins - (互素充要ax+by=1)
J - Good Coins Gym - 101020J所以给定两个大小的硬币应用加减拼凑出所有大小的硬币。有了一就可以有一切哦#include<bits/stdc++.h>using namespace std;int main(){ int t,n,m; cin>>t; while(t--) { c...原创 2018-08-02 14:55:32 · 436 阅读 · 0 评论 -
I - Playing With Strings(字符能否够成对称)
I - Playing With Strings Gym - 101020I 注意分一下奇偶:#include<bits/stdc++.h>using namespace std;int mmp[30];int main(){ int t; cin>>t; while(t--) { int sum=0;...原创 2018-08-02 15:01:27 · 430 阅读 · 0 评论 -
G - Cutie Pie(find ‘pie’-vertical, horizontal, and radial)
G - Cutie Pie Gym - 101020G可以简化一下 开大一下数组 从1开始 存储然后搜索按照中心思想 查找ivertical, horizontal, and radial(学习三个单词 follow me : 竖直,水平adj.径向的; 辐射状的; 放射式的; 星形的;)#include<bits/stdc++.h>using names...原创 2018-08-02 15:06:13 · 299 阅读 · 0 评论 -
F - The Best Strategy
F - The Best Strategy Gym - 101020F The total penalty is the sum of penalties for all solved problems. The penalty for a solved problem is equal to the number of minutes which have passed after th...原创 2018-08-02 19:45:51 · 243 阅读 · 0 评论 -
D - Circular Dance-思维-dfs
D - Circular Dance 思路: 随便选定一个起点即可。那就选择 1吧 , 选择建边 来把原来的图 恢复, 题目给出的信息是这个点后面的两个点 我们不能确定这个点与谁相连,当能知道的是 后面的两个点一定相连,所以建两个无向边,最终得到的vector 是 每个点都有 两个相连的点,一左一右, 题目让输出的是 从左往右 ,所以我们要保证 dfs恢复图的过程中 从1出发是往后走 。...原创 2018-12-28 20:39:59 · 426 阅读 · 0 评论