QFNU-ACM 2020.04.05个人赛补题
A.CodeForces-124A
(简单数学题)
- #include<cstdio>
- #include<algorithm>
- #include<iostream>
- #include<cmath>
- using namespace std;
- int main(){
- int a,b,n;
- scanf("%d %d %d",&n,&a,&b);
- if((n-a)>b){
- printf("%d",b+1);
- }else{
- printf("%d",n-a);
- }
- }
D.cAPS
要么只包含大写字母,要么除了第一个字母外都是大写,才进行变化,否则输出原来字符串
多注意题目要求,仔细读题。
- 1 #include<stdio.h>
- 2 #include<string.h>
- 3 int main(){
- 4 char s[110];
- 5 gets(s);
- 6 int len;
- 7 len=strlen(s);
- 8 int flag=0;
- 9 for(int i=1;i<len;i++){
- 10 if(s[i]>='a'&&s[i]<='z'){
- 11 flag=1;
- 12 break;
- 13 }
- 14 }
- 15 if(flag==1){
- 16 puts(s);
- 17
- 18 }else{
- 19 for(int i=0;i<len;i++){
- 20 if(s[i]>='a'&&s[i]<='z'){
- 21 printf("%c",s[i]-'a'+'A');
- 22 }else{
- 23 printf("%c",s[i]-'A'+'a');
- 24 }
- 25 }
- 26 }
- 27
- 28 }
E.Opposites Attract
数学问题,相反数的个数相乘即可,但是注意0需要特判,数字和数组也要开__int64
- 1 #include<cstdio>
- 2 #include<cstring>
- 3 #include<algorithm>
- 4 #include<cmath>
- 5 using namespace std;
- 6 __int64 a[11]={0},b[11]={0};
- 7 int main(){
- 8 __int64 n,m,sum=0;
- 9 scanf("%I64d",&n);
- 10
- 11 for(int i=0;i<n;i++){
- 12 scanf("%I64d",&m);
- 13 if(m>0){
- 14 a[m]++;
- 15 }else{
- 16 b[-m]++;
- 17 }
- 18 }
- 19 for(int i=0;i<=10;i++){
- 20 sum+=(a[i]*b[i]);
- 21 }
- 22 if(b[0]>1){
- 23 sum+=(b[0]*(b[0]-1))/2;
- 24 }
- 25 printf("%I64d",sum);
- 26 }
F.The World IS A Theatre
组合数学问题
- 1 #include<cstdio>
- 2 #include<cstring>
- 3 #include<algorithm>
- 4 #include<cmath>
- 5 using namespace std;
- 6 __int64 calcu(__int64 a,__int64 b);
- 7 int main(){
- 8 __int64 m,n,sum=0,t;
- 9 scanf("%I64d %I64d %I64d",&n,&m,&t);
- 10 for(int i=4;i<=t-1;i++){
- 11 sum+=(calcu(n,i)*calcu(m,t-i));
- 12 }
- 13 printf("%I64d",sum);
- 14
- 15 }
- 16 __int64 calcu(__int64 a,__int64 b){
- 17 __int64 i,item=1;
- 18 if(b>a) return 0;
- 19 int j=min(a-b,b);
- 20 for(i=1;i<=j;i++){
- 21 item*=a;
- 22 a--;
- 23 item/=i;
- 24
- 25 }
- 26 return item;
- 27
- 28 }
QFNU-ACM 2020.04.05个人赛补题的更多相关文章
- 2020.12.3--vj个人赛补题
A Vasya studies music.He has learned lots of interesting stuff. For example, he knows that there are ...
- 2020.10.30--vj个人赛补题
D - D CodeForces - 743A Vladik is a competitive programmer. This year he is going to win the Interna ...
- 2020.10.23-vj个人赛补题
B - B Polycarp loves lowercase letters and dislikes uppercase ones. Once he got a string s consistin ...
- 2020.10.16--vj个人赛补题
D - Drinks Choosing Old timers of Summer Informatics School can remember previous camps in which eac ...
- 2020.10.9--vj个人赛补题
B - A Tide of Riverscape 题意:给出一组字符串,由'0','1',' . '组成,' . '可以换成 0或1,判断第 i 个和第 i+p 个字符是否可以不相等,如果可以则输出 ...
- LCCUP 2020 秋季编程大赛 补题
果然是力扣杯,难度较于平时周赛提高了不少,个人感觉最后两题并不太容易QAQ LCP 18.早餐组合 #二分思想 题目链接 题意 你获得了每种主食的价格,及每种饮料的价格,你需要选择一份主食和一份饮料, ...
- Technocup 2020 - Elimination Round 1补题
慢慢来. 题目册 题目 A B C D tag math strings greedy dp 状态 √ √ √ √ //∅,√,× 想法 A. CME res tp A 题意:有\(n\)根火柴,额外 ...
- 第十届山东省acm省赛补题(1)
今天第一场个人训练赛的题目有点恐怖啊,我看了半个小时多硬是一道都不会写.我干脆就直接补题去了.... 先补的都是简单题,难题等我这周末慢慢来吧... A Calandar Time Limit: 1 ...
- 【补题记录】ZJU-ICPC Summer Training 2020 部分补题记录
补题地址:https://zjusummer.contest.codeforces.com/ Contents ZJU-ICPC Summer 2020 Contest 1 by Group A Pr ...
随机推荐
- 攻防世界 reverse 2ex1
2ex1 CISCN-2018-Quals mark 1 import base64 2 3 std_base= "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijk ...
- [倍增]luogu P4155 [SCOI2015]国旗计划
题面 https://www.luogu.com.cn/problem/P4155 问在环上最少取多少个区间能完全覆盖环 分析 首先发现是环,先把端点变为2n方便处理,注意离散化 其次要删去贡献不如其 ...
- OAuth2.0授权码模式实战
OAuth2.0是目前比较流行的一种开源授权协议,可以用来授权第三方应用,允许在不将用户名和密码提供给第三方应用的情况下获取一定的用户资源,目前很多网站或APP基于微信或QQ的第三方登录方式都是基于O ...
- 使用KeepAlived来实现高可用的DR模型
环境 VMware 16 CentOS8 相关软件 keepalived ipvsadm httpd 准备工作 准备四个节点,如上图,Node01 ~ Node04, 本文默认你会在VMWare上安装 ...
- Jenkins 实现Gitlab事件自动触发Jenkins构建及钉钉消息推送
实现Gitlab事件自动触发Jenkins构建及钉钉消息推送 实践环境 GitLab Community Edition 12.6.4 Jenkins 2.284 Post build task 1. ...
- 附031.Kubernetes_v1.20.4高可用部署架构二
kubeadm介绍 kubeadm概述 参考附003.Kubeadm部署Kubernetes. kubeadm功能 参考附003.Kubeadm部署Kubernetes. 本方案描述 本方案采用kub ...
- CMD控制台(命令提示符)的打开方式
打开CMD的方式 打开+系统+命令提示符 Win键 +R 输入cmd 打开控制台(推荐使用) 在任意的文件夹下面,按住shift键+鼠标右键点击+在此处打开命令行窗口 资源管理器的地址栏前面加上cmd ...
- Java刷题-tree
一.分别按照二叉树先序,中序和后序打印所有的节点. 这道题就是书上的算法思想的实际使用,唯一需要特别注意到的是用递归的方式建树,还是比较巧妙的,因为一棵树的建立过程字符流是重复使用的,用递归的方式对根 ...
- 使用Vue-TreeSelect组件实现公司-部门-人员级联下拉列表的处理
最近在改造原有Bootstrap开发框架,增加一个Vue&Element前端的时候,发现需要处理一个级联更新的过程,就是选择公司,然后更新部门,选择部门,或者人员列表,选择作为主管的一个实现, ...
- 算法、数据结构、与设计模式等在游戏开发中的运用 (一):单例设计(Singleton Design)
算法.数据结构.与设计模式等在游戏开发中的运用 (一):单例设计(Singleton Design) 作者: Compasslg 李涵威 1. 什么是单例设计(Singleton Design) 在学 ...