Codeforces 1154C Gourmet Cat】的更多相关文章

题目链接:http://codeforces.com/problemset/problem/1154/C 题目大意: 主人有一只猫.周一&周四&周日:吃鱼周二&周六:吃兔子周三&周五:吃鸡 他们现在要外出旅游.他们带了一个包,包里有:a份鱼肉b份兔肉c份鸡肉 问,猫的主人在最优解的情况下(即他可以自由的选择周几出去旅游),最多可以多少天不额外在外购买猫粮?(即,这个包最多能够猫吃多少天) [猫一天就吃一份] 分析: 首先把能吃完整7天的食量减掉,接下来的食物配比就只能吃0~…
题意:你要带着你的喵咪一起去旅行,你的喵在星期\(1,4,7\)吃喵粮\(x\),在星期\(2,6\)吃喵粮\(y\),在星期\(3,5\)吃喵粮\(z\),你只有\(a\)个\(x\),\(b\)个\(y\),\(c\)个\(z\),一旦吃完旅行就结束了,问你选择星期几出发能使旅行的天数最长. 题解:这已经是这个星期第三次碰到这种idea的题了,我们一定是旅行了几个(或者0)星期的循环后才会结束,所以先求出最多能跑几个循环,然后剩下的枚举求个最大值即可. 代码: int a,b,c; // a…
A gourmet came into the banquet hall, where the cooks suggested n dishes for guests. The gourmet knows the schedule: when each of the dishes will be served. For i-th of the dishes he knows two integer moments in time ai and bi (in seconds from the be…
题目链接 给你n种菜, 每一种可以开始吃的时间不一样, 结束的时间也不一样. 求每种菜吃的时间都相同的最大的时间.时间的范围是0-10000. 看到这个题明显可以想到网络流, 但是时间的范围明显不允许我们把对每一个时间都连边. 那么我们可以对时间的区间连边, 对于一个区间, 如果一盘菜的开始时间>=这个区间的左端点, 结束时间小于右端点, 那么这盘菜就对这个时间段连边, 权值inf.然后每个时间段对汇点t连边, 权值为这段时间的长度. 源点s向每个菜连边, 权值为二分枚举的时间长度, 然后跑最大…
链接:https://codeforces.com/contest/1154 A - Restoring Three Numbers - [水] #include<bits/stdc++.h> using namespace std; ]; int main() { cin>>a[]>>a[]>>a[]>>a[]; sort(a,a+); ;i<=;i++) printf(]-a[i]); } B - Make Them Equal - […
Codeforces Round #552 (Div. 3) 题目链接 A. Restoring Three Numbers 给出 \(a+b\),\(b+c\),\(a+c\) 以及 \(a+b+c\) 这四个数,输出一种合法的 \(a,b,c\).   可以发现,前面的两个数加起来减去最后的 \(a+b+c\),答案就出来一个.最后这样求出\(a,b,c\)即可. 代码如下: Code #include <bits/stdc++.h> using namespace std; typede…
A. Restoring Three Numbers 代码: #include <bits/stdc++.h> using namespace std; ]; int a, b, c; int main() { ; i < ; i ++) scanf("%d", &n[i]); sort(n, n + ); a = n[] - n[]; b = n[] - n[]; c = n[] - n[]; printf("%d %d %d\n", a…
A - Restoring Three Numbers CodeForces - 1154A Polycarp has guessed three positive integers aa, bb and cc. He keeps these numbers in secret, but he writes down four numbers on a board in arbitrary order — their pairwise sums (three numbers) and sum o…
Problem   Codeforces #541 (Div2) - D. Gourmet choice Time Limit: 2000 mSec Problem Description Input Output The first line of output should contain "Yes", if it's possible to do a correct evaluation for all the dishes, or "No" otherwis…
学了这么久,来打一次CF看看自己学的怎么样吧 too young too simple 1152B. Neko Performs Cat Furrier Transform 题目链接:"https://codeforces.com/contest/1152/problem/B" 题目描述: Cat Furrier Transform is a popular algorithm among cat programmers to create longcats. As one of th…
F. Gourmet and Banquet time limit per test 2 seconds memory limit per test 512 megabytes input standard input output standard output A gourmet came into the banquet hall, where the cooks suggested n dishes for guests. The gourmet knows the schedule:…
A gourmet came into the banquet hall, where the cooks suggested n dishes for guests. The gourmet knows the schedule: when each of the dishes will be served. For i-th of the dishes he knows two integer moments in time ai and bi (in seconds from the be…
Mr. Apple, a gourmet, works as editor-in-chief of a gastronomic periodical. He travels around the world, tasting new delights of famous chefs from the most fashionable restaurants. Mr. Apple has his own signature method of review  — in each restauran…
After waking up at hh:mm, Andrew realised that he had forgotten to feed his only cat for yet another time (guess why there's only one cat). The cat's current hunger level is H points, moreover each minute without food increases his hunger by D points…
http://codeforces.com/problemset/problem/1163/B2 题意:有n天,每天有一个颜色,截取前x天,随便抽掉一天,使剩下的各个颜色出现的次数相等. 解题,也可以解决B1: 有三种情况: 1.一种颜色出项一次,其他相等,抽掉出现1次颜色的那一天,例如13天分别是 6 222 333 444 555 2.只有两种颜色次数,次数相差1,并且最大出现次数的颜色只有1次,例如13天分别是 777 333 222 8888 3.所有颜色都只出现过1次,例如 1 2 3…
http://codeforces.com/contest/1154/problem/C 题意: 有一只猫,周一周四周日吃鱼肉,周二周六吃兔肉,周三周五吃鸡肉,现给出三种肉的数量,问最多能吃多少天? 解题: 先看看这些肉最多能支撑多少个完整周,必然会有最少的一样肉求模后很小,多出来的肉从周一到周日暴力循环,接在完整周的前后. #include<stdio.h> #include<math.h> #include<string.h> #include<algorit…
Neko Performs Cat Furrier TransformCodeForces - 1152B 题目大意:给你一个x,在40步操作以内把x变成2m−1,m为非负整数.对于每步操作,奇数步可以在(0<=n<=30)中挑选一个n,将x⊕(2n−1),而偶数步将x++.输出操作步数,以及在每个奇数步异或的n,多个答案,输出任一答案,保证至少有一个答案. 一开始傻逼了,真的照题意所说的去写了一个深搜,果断超时了.其实每个奇数步也是异或一个二进制全1的数,那我们就直接把x尾部连续0部分,全部…
传送门 题意: 给出一个数x,有两个操作: ①:x ^= 2k-1; ②:x++; 每次操作都是从①开始,紧接着是② ①②操作循环进行,问经过多少步操作后,x可以变为2p-1的格式? 最多操作40次,输出操作数和所有操作中步骤①的操作数的k: 我的思路: 操作①每次都是异或 (k-1) 个1: 我们最终的结果是将 x 变为(p-1)个1: 那么,我们只要每次异或操作都将x中最高的0位变为1: 因为x最多只有20位,所以,完全可以在40个操作内将x变为(p-1)个1: 例如: 7654321(位置…
ls是一个特别堕落的小朋友,对于n个连续的小时,他将要么睡觉要么打隔膜,一个小时内他不能既睡觉也打隔膜 ,因此一个小时内他只能选择睡觉或者打隔膜,当然他也必须选择睡觉或打隔膜,对于每一个小时,他选择睡觉或 打隔膜的愉悦值是不同的,对于第i个小时,睡觉的愉悦值为si,打隔膜的愉悦值为ei,同时又有一个奥妙重重的 规定:对于任意一段连续的k小时,ls必须至少有t1时间在睡觉,t2时间在打隔膜.那么ls想让他获得的愉悦值尽 量大,他该如何选择呢? 题意:就是N天,每天可以选择S或者E,每一天S或者E有…
题面: 传送门 题目描述: 题意:确定最大的x,使去除掉前x天的其中一天后,所有不同数字的数量相等.   题目分析: 可能是我太久没打cf了,水题都做不出来. 这道题的关键在于:要记录相同数量,的不同数字,有多少个.为什么要这样记录呢?我们分析一下符合题意的有多少种情况: 1.每个不同的数字只出现1次,例:1,2,3,4,5 2.只有一种数字,例:1,1,1,1,1 3.只有一种数字出现1次,其他数字出现的次数相同,例:1,1,1,2,2,2,3 4.有一种数字出现的次数比其他数字都多出1次,例…
题目链接:http://codeforces.com/contest/580/problem/C #include<cstdio> #include<vector> #include<cstring> #define MAX 100010 using namespace std; vector <int> a[MAX]; int visit[MAX]; int cat[MAX]; int leaf[MAX]; int ans,m; void dfs(int…
C. Kefa and Park Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/580/problem/C Description Kefa decided to celebrate his first big salary by going to the restaurant. He lives by an unusual park. The park is a rooted tree con…
D. Mahmoud and a Dictionary time limit per test 4 seconds memory limit per test 256 megabytes input standard input output standard output Mahmoud wants to write a new dictionary that contains n words and relations between them. There are two types of…
D. Mahmoud and a Dictionary time limit per test:4 seconds memory limit per test:256 megabytes input:standard input output: standard output Mahmoud wants to write a new dictionary that contains n words and relations between them. There are two types o…
D. Gourmet choice 链接:http://codeforces.com/contest/1131/problem/D 思路: =  的情况我们用并查集把他们扔到一个集合,然后根据 > < 跑拓扑排序,根据拓扑排序的结果从小到大填数字就好了,需要注意的细节写在代码注释里了 代码: #include<bits/stdc++.h> using namespace std; ; int f[M],n,m; set<int>st[M]; vector<int&…
目录 Codeforces 1131 A.Sea Battle B.Draw! C.Birthday D.Gourmet choice(拓扑排序) E.String Multiplication(思路) F.Asya And Kittens(链表) G.Most Dangerous Shark Codeforces 1131 比赛链接 hack一个暴力失败了两次最后还是没成功身败名裂= = CF跑的也太快了吧... 不过倒也涨了不少. A.Sea Battle //想麻烦了,但是无所谓... #…
Problem D. Grumpy Cat 题目连接: http://www.codeforces.com/gym/100253 Description This problem is a little bit unusual. Here you are to implement an interaction with a testing system. That means that you can make queries and get responses in the online mo…
A. Mahmoud and Longest Uncommon Subsequence time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output While Mahmoud and Ehab were practicing for IOI, they found a problem which name was Longest comm…
D. Mahmoud and a Dictionary time limit per test 4 seconds memory limit per test 256 megabytes input standard input output standard output Mahmoud wants to write a new dictionary that contains n words and relations between them. There are two types of…
  D. Gourmet choice time limit per test 2 seconds memory limit per test 256 megabytes   题目链接: https://codeforces.com/problemset/problem/1131/D Discribe Mr. Apple, a gourmet, works as editor-in-chief of a gastronomic periodical. He travels around the…