23暑假友谊赛No.2

A-雨_23暑假友谊赛No.2 (nowcoder.com)

#include <bits/stdc++.h>

using namespace std;

signed main() {

    ios::sync_with_stdio(false);cin.tie(nullptr);
int a,b,c,d,x;
cin >> a >> b >> c >> d >> x;
cout << (a > x ? 0 : x - a) << ' ' << (b > x ? 0 : x - b) << ' ' << (c > x ? 0 : x - c)<< " " << (d > x ? 0 : x - d); return 0;
}

B-吻_23暑假友谊赛No.2 (nowcoder.com)

啊,忘了加后取模,我真傻,真的.

#include <bits/stdc++.h>
#define int long long using namespace std; signed main() { ios::sync_with_stdio(false);cin.tie(nullptr); const int mod = 998244353;
int n;
cin >> n;
n %= mod;
cout << (n % mod + n % mod * (n - 1) % mod) % mod << endl; return 0;
}

C-失_23暑假友谊赛No.2 (nowcoder.com)

模拟

#include <bits/stdc++.h>
#define int long long using namespace std; signed main() { ios::sync_with_stdio(false);cin.tie(nullptr); string s;
int n;
cin >> s >> n;
vector<string> ans(n);
for(auto &i : ans) cin >> i; vector<int> k(n);
for(int i = 0;i < n;i ++){
if(ans[i].size() != s.size()){
k[i] = 0;
}else{
for(int j = 0;j < s.size();j ++)
k[i] += (ans[i][j] == s[j]);
}
} vector<string> res;
int m = *max_element(k.begin(),k.end());
for(int i = 0;i < n;i ++){
if(k[i] == m)
res.emplace_back(ans[i]);
} sort(res.begin(),res.end());
for(auto i : res)
cout << i << endl; return 0;
}

D-吹_23暑假友谊赛No.2 (nowcoder.com)(动态规划)

\(dp[i][0/1]\)表示当前数为1或原数时的最大可爱值.

若当前数为1,则它的最大值为它左边为1的可爱值为原数时加上原数 - 1的可爱值

若当前数为原数,则它的最大值为左边为1加上当前数 - 1 或 为 原数时加上原数与当前数的差的绝对值

#include <bits/stdc++.h>
#define int long long using namespace std; signed main() { ios::sync_with_stdio(false);cin.tie(nullptr); int n;
cin >> n;
vector<int> a(n);
for(auto &i : a) cin >>i ; vector dp(n,vector<int>(2,0));
for(int i = 1;i < n;i ++){
dp[i][0] = max(dp[i - 1][0],dp[i - 1][1] + abs(a[i - 1] - 1)) ;
dp[i][1] = max(dp[i - 1][0] + abs(a[i] - 1), dp[i - 1][1] + abs(a[i - 1] - a[i]));
}
cout << max(dp[n - 1][0],dp[n - 1][1]) << endl; return 0;
}

E-唤_23暑假友谊赛No.2 (nowcoder.com)

首先边长为4,5,6的纸片都各需要一个正方形边框,而一个正方形边框可以装4个边长为3的纸片,边长为2和1的纸片可以放在这些纸片的空隙中,需要特殊处理.

一个边长为4的纸片可以放5个边长为2的,四个边长为3的纸片放不了边长为2的,一个边长为3的可以放5个,二个边长为3的可以放3个,三个边长为3的可以放1个,处理出当前有多少空隙可以放边长为2的纸片后继续处理边长为1的.

边长为1的只要看当前的边框面积减去已放入的纸片的面积,剩下的面积都能放边长为1的,比较一下看看还需不需要再继续加边框即可

#include <bits/stdc++.h>
#define int long long using namespace std; signed main() { ios::sync_with_stdio(false);cin.tie(nullptr); int T;
cin >> T;
while(T--){
int s;
cin >> s;
int s3[] = {0,5,3,1};
vector<int> k(7);
for(int i = 1;i <= 6;i ++) cin >> k[i]; int ans = 0;
ans += k[6] + k[5] + k[4] + (k[3] + 3) / 4; int num2 = 5 * k[4] + s3[k[3] % 4];
if(k[2] > num2)
ans += (k[2] - num2 + 8) / 9; int sum = ans * 36 - k[6] * 36 - k[5] * 25 - k[4] * 16 - k[3] * 9 - k[2] * 4;
if(k[1] > sum)
ans += (k[1] - sum + 35) / 36; cout << (ans > s ? "No" : "Yes") << endl;
} return 0;
}

23暑假友谊赛No.2的更多相关文章

  1. 合肥学院ACM集训队第一届暑假友谊赛 B FYZ的求婚之旅 D 计算机科学家 F 智慧码 题解

    比赛网址:https://ac.nowcoder.com/acm/contest/994#question B FYZ的求婚之旅 思路: 然后用快速幂即可. 细节见代码: #include <i ...

  2. 暑假训练round 3 题解

    今天做题运气出奇的好,除了几处小错误调试之后忘记改掉了……最后还AK了……虽然题目不难,学长也说是福利局,但是对个人的鼓励作用还是挺大的……至此暑假训练就结束了,也算没有遗憾……. 题解如下: Pro ...

  3. 20172305 暑假作业 之 TimeCalculate & Save Iron Man

    20172305 暑假作业 之 TimeCalculate & Save Iron Man TimeCalculate 项目介绍 项目名称: TimeCalculate 项目简介: 本项目基于 ...

  4. STL 入门 (17 暑假集训第一周)

    快速全排列的函数 头文件<algorithm> next_permutation(a,a+n) ---------------------------------------------- ...

  5. [置顶] 2013_CSUST暑假训练总结

    2013-7-19 shu 新生训练赛:母函数[转换成了背包做的] shuacm 题目:http://acm.hdu.edu.cn/diy/contest_show.php?cid=20083总结:h ...

  6. 2014年暑假c#学习笔记目录

    2014年暑假c#学习笔记 一.C#编程基础 1. c#编程基础之枚举 2. c#编程基础之函数可变参数 3. c#编程基础之字符串基础 4. c#编程基础之字符串函数 5.c#编程基础之ref.ou ...

  7. Java开发中的23种设计模式详解

    [放弃了原文访问者模式的Demo,自己写了一个新使用场景的Demo,加上了自己的理解] [源码地址:https://github.com/leon66666/DesignPattern] 一.设计模式 ...

  8. ILJMALL project过程中遇到Fragment嵌套问题:IllegalArgumentException: Binary XML file line #23: Duplicate id

    出现场景:当点击"分类"再返回"首页"时,发生error退出   BUG描述:Caused by: java.lang.IllegalArgumentExcep ...

  9. CSharpGL(23)用ComputeShader实现一个简单的ParticleSimulator

    CSharpGL(23)用ComputeShader实现一个简单的ParticleSimulator 我还没有用过Compute Shader,所以现在把红宝书里的例子拿来了,加入CSharpGL中. ...

  10. ABP(现代ASP.NET样板开发框架)系列之23、ABP展现层——异常处理

    点这里进入ABP系列文章总目录 基于DDD的现代ASP.NET开发框架--ABP系列之23.ABP展现层——异常处理 ABP是“ASP.NET Boilerplate Project (ASP.NET ...

随机推荐

  1. This app has crashed because it attempted to access privacy-sensitive data without a usage descripti

    运行环境 XCode 8.2.1 问题描述 当调取相册的时候APP崩溃并显示标题的错误:This app has crashed because it attempted to access priv ...

  2. 【VMware vSphere】使用RVTools中的PowerShell脚本创建导出vSphere环境信息的自动化任务。

    RVTools 是 VMware 生态系统中一个非常受欢迎且免费的 Windows 实用工具,用于收集并显示 VMware vSphere 环境中的相关信息,如虚拟机.主机及集群等相关配置.RVToo ...

  3. ecnuoj 5039 摇钱树

    5039. 摇钱树 题目链接:5039. 摇钱树 感觉在赛中的时候,完全没有考虑分数规划这种做法.同时也没有想到怎么拆这两个交和并的式子.有点难受-- 当出现分数使其尽量大或者小,并且如果修改其中直接 ...

  4. Nacos + Gateway网关搭建微服务

    文章所有代码GtiHub:https://github.com/Tom-shushu/work-study 里面的gateway-server和server1项目 1.Docker 部署 Nacos ...

  5. CF1523D Love-Hate

    抽象化题意: 一共有 \(m\) 个元素,给定 \(n\) 个集合,每个集合的元素不超过 \(15\) 个,求出一个元素个数最多的集合 \(S\) 是至少 \(\lceil \dfrac{n}{2} ...

  6. arm linux 移植 curl

    背景 libcurl是一个跨平台的开源网络协议库,支持http, https, rtsp等多种协议 .libcurl同样支持HTTPS证书授权,HTTP POST, HTTP PUT, FTP 上传, ...

  7. ubuntu22 python2 pyinstaller 打包报错:'NoneType' object has no attribute 'groups'

    前言 最近有个需求,需要在 ubnutu22 上使用 pyinstaller 打包一个python2 的文件. 中间遇到了一些问题: pip2 install pyinstaller 报错 解决方案: ...

  8. WebGL管网展示(及TubeGeometry优化)

    前言 管路展示在三维场景中很常见.比如地下管网,建筑里面的水果,暖通管道等等的展示. 建立管路的方式主要两种: 通过3DMax C4D Blender等建模工具进行建模. 通过路径数据,程序生成三维管 ...

  9. Python 基于xml.etree.ElementTree实现XML对比

    测试环境 Python 3.6 Win10 代码实现 #!/usr/bin/env python 3.4.0 #-*- encoding:utf-8 -*- __author__ = 'shouke' ...

  10. 配置docker镜像时碰到的问题

    在配置docker镜像时,首先我是这样操作的 , echo "registry-mirrors": ["https://ry1ei7ga.mirror.aliyuncs. ...