codeforces 979A Pizza, Pizza, Pizza!!!】的更多相关文章

题意: 对一个圆形的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);…
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…
C - Ordering Pizza CodeForces - 867C C - Ordering Pizza 这个是最难的,一个贪心,很经典,但是我不会,早训结束看了题解才知道怎么贪心的. 这个是先假设每个人都可以吃到他喜欢的,就是先求出答案,然后按照b-a 排序,分别放入两个优先队列里面, 如果b>a 那就吃第二块,否则就吃第一块,求出num,注意优先队列按照从小到达排序. num1记录第一块吃的数量,num2记录第二块吃的数量. num1%=s,num2%=s  如果num1+num2的数…
#ifndef __INGREDIENT_H__ #define __INGREDIENT_H__ #include <iostream> using namespace std; class Dough { }; class ThinDough:public Dough { }; class BigDough :public Dough { }; class CaDough :public Dough { }; class Sauce { }; class MariSauce : publi…
#ifndef __PIZZA_H__ #define __PIZZA_H__ class Pizza { public: Pizza(){} virtual ~Pizza(){} virtual const char* getPizzaName() { return "Pizza"; } }; class NYCheesePizza : public Pizza { public: NYCheesePizza(){} virtual~NYCheesePizza(){} virtual…
标题这么长的..真是让感觉人头大脚轻. 贴题面先. Description     Moo大学的餐厅必须为$C(1\leq C\leq 1000)$头入学的奶牛新生定制比萨饼.比萨饼可以在比萨小屋订做.一个饼只能给一头奶牛吃.尽管比萨小屋想为每一头奶牛都做一个比萨饼,但是他们必须服从以下三个条件: ·比萨小屋拥有$T(1\leq T\leq 30)$种素菜馅,每个比萨饼有且仅有$K(1\leq K\leq T)$种馅. ·任何一个比萨饼里不能有两种相同的馅(比如一个比萨饼里不能有两份洋葱). ·…
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…
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;+…
传送门: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…
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…