链接: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相关推荐

  1. CodeCraft-19 and Codeforces Round #537 (Div. 2) Editorial

    CodeCraft-19 and Codeforces Round #537 (Div. 2) Editorial A 不说了 代码 #include<bits/stdc++.h> usi ...

  2. 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 ...

  3. Codeforces Round #552 (Div. 3) C题

    题目链接 http://codeforces.com/contest/1154/problem/C 题目 C. Gourmet Cat time limit per test 1 second mem ...

  4. Codeforces Round #552 (Div. 3) E stl模拟 F dp G gcd

    contest链接 https://codeforces.com/contest/1154 E 题解思路 直接哈希模拟删除T了,可以用setsetset和lowerlowerlower_boundbo ...

  5. Codeforces Round #552 (Div. 3)D、E题解

    D. Walking Robot 题意 机器人在一维坐标轴上从0走到x,中途可以在有光的地方可以选择给太阳能电池充电,每次移动都要消耗一单位电,蓄电池容量为a,太阳能电池容量为b,一开始都是满电,问机 ...

  6. 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 ...

  7. Codeforces Round #552 (Div. 3) —— A. Restoring Three Numbers

    A. Restoring Three Numbers A.恢复三个数字 time limit per test1 second 每次测试的时间限制1秒 memory limit per test256 ...

  8. Codeforces Round #786 (Div. 3) Editorial(A/B/C/D)待补

    A. int main() {IOS;// freopen("P1908_6.in","r",stdin);//读入数据// freopen("P19 ...

  9. Codeforces Round #552 Div. 3

    题目链接:戳我 前两题是littlesun_wl小可爱写的qwqwq A #include<iostream> #include<cstdio> #include<cst ...

最新文章

  1. 2022年值得关注的8个人工智能趋势
  2. 逻辑设计中复位的稳妥处理方法?
  3. Asp.net MVC4.0(net4.5) 部署到window server 2003上的解决方案
  4. mysql主程序目录_MySQL™ 参考手册(目录)
  5. 【JavaSE02】Java基本语法-注意点
  6. 怎么用cmd关闭系统弹窗_Win10家庭版系统也能使用组策略啦!终于关闭系统自动更新了...
  7. 大学生开题报告php,php毕业设计开题报告
  8. 第2步 安装git 配置git用户 git的安装和项目的建立
  9. 微信小程序自带地图_微信小程序之map地图
  10. 软件测试入门到飞升上仙之web 端测试
  11. 网络爬虫Heritrix源码分析(一) 包介绍
  12. Activiti7的进阶使用
  13. 员工绩效考核指标设计主要原则(zt)
  14. FYI | 谷歌的summer project围观一下
  15. java 多线程发送邮件_多线程实现发送邮件功能
  16. 5G套餐资费会越来越便宜,但需注意“限速机制”
  17. TLS/SSL 协议详解(17) Certificate verify
  18. SourceTree报错git -c diff.mnemonicprefix=false fatal: Unable to create ‘D:/xxx/.git/index.lock‘: File
  19. 组播路由协议基础——PIM-SM静态RP
  20. MacBook杀毒软件CleanMyMac X4.13

热门文章

  1. Android学习笔记(九)——更复杂的进度对话框
  2. MySQL中的几类日志文件介绍
  3. python之twisted模块安装
  4. PHP弱类型安全问题总结
  5. linux下svn服务器的安装配置和使用
  6. 利用InfoPath生成XML资源文件
  7. 为 ASP.NET 创建缓存配置对象[转载]
  8. redhat 登录不慢 传文件很慢
  9. 蓝桥杯 ADV-109 算法提高 征税程序
  10. Swarm搭建Docker集群