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 ...
随机推荐
- 【关系抽取-R-BERT】模型结构
模型的整体结构 相关代码 import torch import torch.nn as nn from transformers import BertModel, BertPreTrainedMo ...
- validator库参数校验
目录 validator库参数校验若干实用技巧 基本示例 翻译校验错误提示信息 自定义错误提示信息的字段名 自定义结构体校验方法 自定义字段校验方法 自定义翻译方法 validator库参数校验若干实 ...
- B. Johnny and Grandmaster
原题链接:https://codeforc.es/problemset/problem/1361/B 题意:给你n个k求把pk分成两组数和的最小差值对1e9+7取余. 题解:运用贪心的思想取最大的数减 ...
- Java例题_31 逆序输出数组的值
1 /*31 [程序 31 数组逆序] 2 题目:将一个数组逆序输出. 3 程序分析:用第一个与最后一个交换. 4 */ 5 6 /*分析 7 * 第一种方法:找到这个数组的中间下标,然后交换两端的数 ...
- iNeuOS工业互联平台,发布:消息管理、子用户权限管理、元件移动事件、联动控制和油表饼状图,v3.4版本
目 录 1. 概述... 2 2. 平台演示... 2 3. 消息管理... 2 4. 子用户权限管理... 3 5. 元件移动事件... ...
- 系统编程-信号-信号发送kill、raise、alarm
信号发送 kill 和 raise函数 kill函数参数详解: 实验1 raise和kill 的使用 #include <stdio.h> #include <signal.h> ...
- 批量SSH key-gen无密码登陆认证脚本 附件脚本
# 批量实现SSH无密码登陆认证脚本 ## 问题背景 使用为了让linux之间使用ssh不需要密码,可以采用了数字签名RSA或者DSA来完成.主要使用ssh-key-gen实现. 1.通过 ssh-k ...
- Spring IOC 特性有哪些,不会读不懂源码!
作者:小傅哥 博客:https://bugstack.cn 沉淀.分享.成长,让自己和他人都能有所收获! 一.前言 多线程.锁.JVM调优,都背出花啦,怎么一写代码还是乱糟糟? 为什么这些无论从书本. ...
- Android Studio的基本开发环境,配置阿里云源
原创文章,转发请注明出处. 安装Android Studio 安装文件下载地址:https://developer.android.google.cn/studio/ 下载Gradle 由于国内的网络 ...
- 【笔记】《Redis设计与实现》chapter22 二进制位数组 chapter23 慢查询日志 chapter24 监视器
chapter22 二进制位数组 22.4 BITCOUNT命令的实现 遍历算法 查表算法 variable-precision SWAP算法 chapter23 慢查询日志 Redis的慢查询日志功 ...