Codeforces 895.A Pizza Separation】的更多相关文章

A. Pizza Separation time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Students Vasya and Petya are studying at the BSU (Byteland State University). At one of the breaks they decided to order…
传送门:http://codeforces.com/contest/895/problem/A A. Pizza Separation time limit per test1 second memory limit per test256 megabytes Problem Description Students Vasya and Petya are studying at the BSU (Byteland State University). At one of the breaks…
codeforces 895A Pizza Separation 题目大意: 分成两大部分,使得这两部分的差值最小(注意是圆形,首尾相连) 思路: 分割出来的部分是连续的,开二倍枚举. 注意不要看成01背包,一定多读题 代码: #include <bits/stdc++.h> using namespace std; int a[800]; int main() { int n,minval,sum,tot; cin>>n; tot=0; for(int i=1;i<=n;+…
A. Pizza Separation time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Students Vasya and Petya are studying at the BSU (Byteland State University). At one of the breaks they decided to order…
题目出处:http://codeforces.com/problemset/problem/895/A 题目大意:对于给出的一些角度的披萨分成两份,取最小角度差 #include<stdio.h> #include<stdlib.h> #include<math.h> //Pizza Separation int main(){ int n; scanf("%d",&n); int *a = (int*) malloc (n * sizeof…
A. Pizza Separation time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output Students Vasya and Petya are studying at the BSU (Byteland State University). At one of the breaks they decided to order a pi…
B. XK Segments time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output While Vasya finished eating his piece of pizza, the lesson has already started. For being late for the lesson, the teacher sug…
E. Eyes Closed time limit per test 2.5 seconds memory limit per test 256 megabytes input standard input output standard output Vasya and Petya were tired of studying so they decided to play a game. Before the game begins Vasya looks at array a consis…
D. String Mark time limit per test 4 seconds memory limit per test 256 megabytes input standard input output standard output At the Byteland State University marks are strings of the same length. Mark x is considered better than y if string y is lexi…
C. Square Subsets time limit per test 4 seconds memory limit per test 256 megabytes input standard input output standard output Petya was late for the lesson too. The teacher gave him an additional task. For some array a Petya should find the number…
被B的0的情况从头卡到尾.导致没看C,心情炸裂又掉分了. A. Pizza Separation time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Students Vasya and Petya are studying at the BSU (Byteland State University). At one of the…
B. Gleb And Pizza time limit per test:2 seconds memory limit per test:256 megabytes input:standard input output:standard output Gleb ordered pizza home. When the courier delivered the pizza, he was very upset, because several pieces of sausage lay on…
[Educational Codeforces Round 81 (Rated for Div. 2)]E. Permutation Separation(线段树,思维,前缀和) E. Permutation Separation time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output You are given a permutat…
C - Ordering Pizza CodeForces - 867C C - Ordering Pizza 这个是最难的,一个贪心,很经典,但是我不会,早训结束看了题解才知道怎么贪心的. 这个是先假设每个人都可以吃到他喜欢的,就是先求出答案,然后按照b-a 排序,分别放入两个优先队列里面, 如果b>a 那就吃第二块,否则就吃第一块,求出num,注意优先队列按照从小到达排序. num1记录第一块吃的数量,num2记录第二块吃的数量. num1%=s,num2%=s  如果num1+num2的数…
Gleb ordered pizza home. When the courier delivered the pizza, he was very upset, because several pieces of sausage lay on the crust, and he does not really like the crust. The pizza is a circle of radius r and center at the origin. Pizza consists of…
CodeForces - 842B #include<bits/stdc++.h> using namespace std; int main() { int r,d,t; double temp,x,y,z; while(~scanf("%d %d",&r,&d)) { scanf("%d",&t); ; ; i < t; i++) { scanf("%lf %lf %lf",&x,&y…
题意: 对一个圆形的pizza,只能用直线来切它,求把它切为n+1份的形状和size都相同的最下次数. 思路: 形状和size都相同,那么只能是扇形,分奇偶讨论. n为0还得特判,切0刀,因为这个还被hack一发,汗. 代码: #include <stdio.h> int main() { long long n; scanf("%lld",&n); ) { printf("); ; } n++; ) printf("%lld",n);…
https://codeforces.com/contest/1295/problem/E 建一颗线段树,叶子结点是花费从1到i所需要花费的前缀和,表示前i个元素全部移动到右边的花费,再维护区间最小值,然后从1到n-1扫一遍,对于第i个位置,找到数字i在序列中的位置 pos ,将区间1到pos-1加上数字i移动的花费,pos到n-1减去数字i移动的花费,因为位置大于等于i 的时候,不需要将数字i移动到右边,位置小于i 时,需要把数字i移动到左边,所以需要增加数字i的花费,结合线段树维护的是前缀和…
题意 一棵 \(n\) 个点的树,每个点有权值 \(a_i\) .你想砍树. 你可以砍任意次,每次你选择一些边断开,需要满足砍完后每个连通块的权值和是相等的.求有多少种砍树方案. \(n \le 10^6, a_i \le 10^9\) 题解 先假设只砍一次.令所有点权和为 \(S\) ,那么假设要砍成 \(k\) 个连通块,则每个连通块的权值和均为 \(\displaystyle \frac{S}{k}\) . 考虑如何得到砍的方案,以 \(1\) 号点为根 \(dfs\) ,若当前点 \(i…
题意: n个人吃披萨,总共有两种披萨,每种披萨都是有S块,给出每个人要吃的块数,吃第一种披萨能获得的happy值,吃第二种披萨能获得的happy值,问你,在购买的披萨数最少的情况下能获得的最大的总的happy值是多少(披萨可以买任意多个,吃不完也行 2333333) Examples Input 3 123 5 74 6 75 9 5 Output 84 Input 6 107 4 75 8 812 5 86 11 63 3 75 9 6 Output 314 思路:首先肯定是每个人都吃happ…
[链接]h在这里写链接 [题意]     给你参赛者的数量以及一个整数S表示每块披萨的片数.     每个参数者有3个参数,si,ai,bi;     表示第i个参赛者它要吃的披萨的片数,以及吃一片第一种披萨增加的幸福感,     以及吃一片第二种披萨增加的幸福感.     两种披萨都能任意数量地订购.     但是总数num有一个上限.     就是S*num>=∑si     且num最小.     也就是说相当于给你一个num;     让你求两种披萨各要买多少个a,b(a+b==num)…
[链接]点击打开链接 [题意] 在这里写题意 [题解] 根据圆心到原点的距离这个东西判断一下圆在不在那个环里面就好 [错的次数] 0 [反思] 在这了写反思 [代码] #include <cstdio> #include <iostream> #include <algorithm> #include <cstring> #include <vector> #include <map> #include <queue> #…
题目链接 link Solution 暴力一眼就可以看出来,枚举分界点,然后左右两边统计答案即可,但复杂度是我们无法接受的 然后我们看我们可以优化哪一部分 \(1^0\) 枚举:这部分没有办法优化 \(2^0\) 统计答案 这里我们看每一个位置上的数字在什么时候会有增加答案 当这种有的位置可以改变答案的时候,我们就要考虑贡献法 由题意,分割点位置不同时,每个位置对于该状态下答案是否贡献是不同的 "是否贡献"还是连续的,直接上线段树维护就好 (这里解释有点玄学,但是用贡献法还是不难理解的…
传送门:http://codeforces.com/contest/895/problem/B B. XK Segments time limit per test1 second memory limit per test256 megabytes Problem Description While Vasya finished eating his piece of pizza, the lesson has already started. For being late for the l…
 Phone Numbers Time Limit:2000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u Submit Status Practice CodeForces 151B Description Winters are just damn freezing cold in Nvodsk! That's why a group of n friends prefers to take a taxi, ord…
Codeforces Round #437 (Div. 2) codeforces 867 A. Between the Offices(水) 题意:已知白天所在地(晚上可能坐飞机飞往异地),问是否从西雅图飞到旧金山次数更多. 题解:只要判断第一天和最后一天状态即可. #include<cstdio> #include<cstring> #include<algorithm> using namespace std; ; int n; char s[N]; int ma…
[感谢牛老板对D题的指点OTZ] codeforces 842 A. Kirill And The Game[暴力] 给定a的范围[l,r],b的范围[x,y],问是否存在a/b等于k.直接暴力判断即可. #include <iostream> #include <cstdio> #include <cstring> #include <algorithm> #include <cmath> using namespace std; typede…
题目链接:http://codeforces.com/problemset/problem/895/C 题意: 给你n个数a[i].(n <= 10^5, 1 <= a[i] <= 70) 问你有多少非空子集s,使得 ∏(s[i])为完全平方数. 题解: 由于a[i] <= 70,而70以内的质数只有19个,显然可以状压. 由于一个数是完全平方数的条件是:它的每种质因子的指数为偶数 所以先处理出对于每个a[i],它的所有质因子指数的奇偶性f[i]. 对于f[i]的每一位,0表示它的…
题目传送门 /* 构造:结构体排个序,写的有些啰嗦,主要想用用流,少些了判断条件WA好几次:( */ #include <cstdio> #include <algorithm> #include <cstring> #include <cmath> #include <vector> #include <map> #include <iostream> #include <string> using name…
BACKGROUND 1. Field Innovations herein pertain to computer virtualization, computer security and/or data isolation, and/or the use of a separation kernel hypervisor (and/or hypervisor), such as to detect and/or prevent malicious code and which may in…