当前位置:网站首页>CSDN竞赛第三期 快递员、小鱼游泳题解
CSDN竞赛第三期 快递员、小鱼游泳题解
2022-08-07 18:48:00 【Dream.Luffy】
快递员:

#include<iostream>
using namespace std;
int main()
{
int n, k;
while(cin >>n >> k)
{
int cnt = 0;
if(k == 13) //当车载货量恰好为13时是不行的
k = 12;
cnt = n / k; //求能运多少整车
if(n % k)
{
if(n % k == 13) //如果剩下的为 13
cnt += 2;
else
cnt ++;
}
cout << cnt << endl;
}
return 0;
}
小鱼游泳
#include<iostream>
using namespace std;
int w[7] = {250, 250,250,250,250, 0, 0};
int main()
{
long long x, n, sum = 0;
cin >>x >> n;
for(int i = x - 1;i < 7;i ++) //先将第一周统计完
sum += w[i];
n -= (7 - x + 1); //计算剩余天数
long long d = n / 7; //统计有多少完整周 ,注意这里也要用long long不然只过20%
for(int i = 0;i < n % 7;i ++) //计算非整周
sum += w[i];
cout << sum + d * 1250; //每周1250公里
return 0;
}边栏推荐
- [2022 杭电多校5] Count Set (生成函数 分治NTT)
- Kuaishou management adjustment: Liu Feng and Ma Hongbin are respectively in charge of commercialization and internationalization
- "Principles of Programming" Reading Notes (1): Prerequisites and Guidelines for Programming
- Spoofing attack common command -arp-dns-dhcp spoofing
- 深入浅出边缘云 | 6. 监控与遥测
- How can corporate culture cure corporate "internal friction"?
- DELL SC康贝存储忘记密码的重置方法
- 字符串去掉()以及()中的文字
- 百万年薪架构师谈:掌握这【6+2】学习路线 进BAT拿月薪40k真不难
- [dp with lots of details] Educational Codeforces Round 133 (Rated for Div. 2) C. Robot in a Hallway
猜你喜欢
随机推荐
长安链fact示例合约statedb存储数据原文带有cmecv1.0原因分析
质数判定与质数表的求解
636. Exclusive time of functions: Simple stack application simulation problem
Technology Sharing | How to do json response assertion in interface automation test?
Language Translator - Online Language Translator Free
C#调用bartender进行动态打印以及批量打印的完整教程
amh 数据库导入功能的建议?
ResNet架构解析
职场经验分享--接口中按时间戳查数据容易被忽略的细节
复爱合缘风波后高管调整:命庄海为总裁 王靖为CFO
1. How a chip is born
Best Student Paper: EPro-PnP
Telnet协议抓包-工具Wireshark
Go-Excelize API源码阅读(三)——OpenReader()
陆金所管理层动荡:冀光恒卸任董事长职务 CFO郑锡贵也退休
MySQL SQL语句限制参数
更简单的掩码图像建模框架SimMIM介绍和PyTorch代码实现
vim你也可以写文本块
浩辰软件IPO过会:年营收2.4亿拟募资7.5亿 红杉是股东
vim you can also write text blocks









