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 ...
随机推荐
- IDA报错fatal error before kernel init
编写了一个IDA64插件,结果再打开IDA后报错fatal error before kernel init,然后闪退. 检查了一遍代码没发现有问题,后来发现是环境有一处配置错误, IDA64.exe ...
- SetWindowsHookEx 消息钩取进程卡死
<逆向工程核心原理> windows消息钩取部分的例子在win10下卡死,失败.通过搜索发现,要保证钩取的进程与注入的dll要保持cpu平台相同 SetWindowsHookEx可用于将d ...
- MySQL数据库与python交互
1.安装引入模块 安装mysql模块 pip install PyMySQL; 文件中引入模块 import pymysql 2.认识Connection对象 用于建立与数据库的连接 创建对象:调用c ...
- Ansible-Playbook中的变量使用
变量名:仅能由字母.数字和下划线组成,且只能以字母开头 变量来源: 1.ansible all -m setup 远程主机的所有变量都可直接调用 #显示所有变量 ansible all -m setu ...
- SpringCloud+Nacos实现服务配置中心(Hoxton版本)
关于 Nacos Spring Cloud 的详细文档请参看:Nacos Config和Nacos Discovery. 通过 Nacos Server 和 spring-cloud-starter- ...
- Postman 使用小技巧/指南
一.什么是 Postman(前世今生) Postman 诞生于 2013 年,一开始只是 Abhinav Asthana 着手于解决 API 测试的工具,随着这个工具的使用者和需求迅速激增,Abhin ...
- Java后端进阶-网络编程(Netty责任链Pipeline)
设计模式-责任链模式 一个责任链模拟demo package com.study.hc.net.netty.demo; // -----链表形式调用------netty就是类似的这种形式 publi ...
- 当前Activity的onPause执行完后,调用Paused接口
目录 前言 详细流程分析 activityPaused:1843, ActivityTaskManagerService activityPaused:4930, ActivityRecord com ...
- JavaFX+SpringBoot+验证码功能的小型薪酬管理系统
2020.07.22更新 1 概述 1.1 简介 一个简单的小型薪酬管理系统,前端JavaFX+后端Spring Boot,功能倒没多少,主要精力放在了UI和前端的一些逻辑上面,后端其实做得很简单. ...
- Alignment of Code UVA - 1593
You are working in a team that writes Incredibly Customizable Programming Codewriter (ICPC) which ...