Codeforces Round #552 (Div. 3) Editorial 1154C - Gourmet Cat
链接:https://codeforces.com/contest/1154/problem/C
题意:一只旅行的小猫在特定的星期里吃特定的食物,一四七a,二六b,三五c,现在给三种食物的数量,问小猫最多能活几天。
思路:先看小猫能活几个整星期,因为a在一个星期里占三天,b和c各占两天,所以取min(a/3,b/2,c/2),然后求剩下的,这个时候就可以枚举日子了,从周一枚举到周日,然后模拟一哈就行了,虽然是个水题但我还是没做粗来
代码:
1 //#include<bits/stdc++.h> 2 #include<iostream> 3 #include<vector> 4 #include<stack> 5 #include<string> 6 #include<cstdio> 7 #include<algorithm> 8 #include<queue> 9 #include<map> 10 #include<set> 11 #include<cmath> 12 #include<iomanip> 13 #define inf 0x3f3f3f3f 14 using namespace std; 15 typedef long long ll; 16 const int M = int(1e5) * 3 + 5; 17 vector<int> a(3); 18 signed main() 19 { 20 //int f, r, c; 21 cin >> a[0] >> a[1] >> a[2]; 22 int k = min({ a[0] / 3,a[1] / 2,a[2] / 2 }); //min新用法√ 23 int day[7] = { 0,1,2,0,2,1,0 }; 24 a[0] -= k * 3; 25 a[1] -= k * 2; 26 a[2] -= k * 2; 27 int ans = 0; 28 for (int i = 0; i < 7; i++) 29 { 30 vector<int> b = a; //vector新用法√ 31 int j = i; 32 int cur = 0; 33 while (b[day[j]] > 0) 34 { 35 b[day[j]]--; 36 j = (j + 1) % 7; //保证j在0到6的范围里 37 cur++; 38 } 39 ans = max(ans, k * 7 + cur); 40 } 41 cout << ans << endl; 42 return 0; 43 }
备注:这次cf让我看到我的实力有所下降,还有一个月就要校赛了,要把状态拉回来,基础要打牢,也要学新东西
转载于:https://www.cnblogs.com/harutomimori/p/10733419.html
Codeforces Round #552 (Div. 3) Editorial 1154C - Gourmet Cat相关推荐
- CodeCraft-19 and Codeforces Round #537 (Div. 2) Editorial
CodeCraft-19 and Codeforces Round #537 (Div. 2) Editorial A 不说了 代码 #include<bits/stdc++.h> usi ...
- Codeforces Round #552 (Div. 3) A B C D E F G (暴力,dp,模拟)
题目链接:https://codeforces.com/contest/1154 A:Restoring Three Numbers B:Make Them Equal C:Gourmet Cat D ...
- Codeforces Round #552 (Div. 3) C题
题目链接 http://codeforces.com/contest/1154/problem/C 题目 C. Gourmet Cat time limit per test 1 second mem ...
- Codeforces Round #552 (Div. 3) E stl模拟 F dp G gcd
contest链接 https://codeforces.com/contest/1154 E 题解思路 直接哈希模拟删除T了,可以用setsetset和lowerlowerlower_boundbo ...
- Codeforces Round #552 (Div. 3)D、E题解
D. Walking Robot 题意 机器人在一维坐标轴上从0走到x,中途可以在有光的地方可以选择给太阳能电池充电,每次移动都要消耗一单位电,蓄电池容量为a,太阳能电池容量为b,一开始都是满电,问机 ...
- Codeforces Round #552 (Div. 3) —— B. Make Them Equal
B. Make Them Equal time limit per test2 seconds memory limit per test256 megabytes inputstandard inp ...
- Codeforces Round #552 (Div. 3) —— A. Restoring Three Numbers
A. Restoring Three Numbers A.恢复三个数字 time limit per test1 second 每次测试的时间限制1秒 memory limit per test256 ...
- Codeforces Round #786 (Div. 3) Editorial(A/B/C/D)待补
A. int main() {IOS;// freopen("P1908_6.in","r",stdin);//读入数据// freopen("P19 ...
- Codeforces Round #552 Div. 3
题目链接:戳我 前两题是littlesun_wl小可爱写的qwqwq A #include<iostream> #include<cstdio> #include<cst ...
最新文章
- 2022年值得关注的8个人工智能趋势
- 逻辑设计中复位的稳妥处理方法?
- Asp.net MVC4.0(net4.5) 部署到window server 2003上的解决方案
- mysql主程序目录_MySQL™ 参考手册(目录)
- 【JavaSE02】Java基本语法-注意点
- 怎么用cmd关闭系统弹窗_Win10家庭版系统也能使用组策略啦!终于关闭系统自动更新了...
- 大学生开题报告php,php毕业设计开题报告
- 第2步 安装git 配置git用户 git的安装和项目的建立
- 微信小程序自带地图_微信小程序之map地图
- 软件测试入门到飞升上仙之web 端测试
- 网络爬虫Heritrix源码分析(一) 包介绍
- Activiti7的进阶使用
- 员工绩效考核指标设计主要原则(zt)
- FYI | 谷歌的summer project围观一下
- java 多线程发送邮件_多线程实现发送邮件功能
- 5G套餐资费会越来越便宜,但需注意“限速机制”
- TLS/SSL 协议详解(17) Certificate verify
- SourceTree报错git -c diff.mnemonicprefix=false fatal: Unable to create ‘D:/xxx/.git/index.lock‘: File
- 组播路由协议基础——PIM-SM静态RP
- MacBook杀毒软件CleanMyMac X4.13