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个人赛补题的更多相关文章

  1. 2020.12.3--vj个人赛补题

    A Vasya studies music.He has learned lots of interesting stuff. For example, he knows that there are ...

  2. 2020.10.30--vj个人赛补题

    D - D CodeForces - 743A Vladik is a competitive programmer. This year he is going to win the Interna ...

  3. 2020.10.23-vj个人赛补题

    B - B Polycarp loves lowercase letters and dislikes uppercase ones. Once he got a string s consistin ...

  4. 2020.10.16--vj个人赛补题

    D - Drinks Choosing Old timers of Summer Informatics School can remember previous camps in which eac ...

  5. 2020.10.9--vj个人赛补题

    B - A Tide of Riverscape 题意:给出一组字符串,由'0','1',' . '组成,' . '可以换成 0或1,判断第 i  个和第 i+p 个字符是否可以不相等,如果可以则输出 ...

  6. LCCUP 2020 秋季编程大赛 补题

    果然是力扣杯,难度较于平时周赛提高了不少,个人感觉最后两题并不太容易QAQ LCP 18.早餐组合 #二分思想 题目链接 题意 你获得了每种主食的价格,及每种饮料的价格,你需要选择一份主食和一份饮料, ...

  7. Technocup 2020 - Elimination Round 1补题

    慢慢来. 题目册 题目 A B C D tag math strings greedy dp 状态 √ √ √ √ //∅,√,× 想法 A. CME res tp A 题意:有\(n\)根火柴,额外 ...

  8. 第十届山东省acm省赛补题(1)

    今天第一场个人训练赛的题目有点恐怖啊,我看了半个小时多硬是一道都不会写.我干脆就直接补题去了.... 先补的都是简单题,难题等我这周末慢慢来吧... A Calandar Time Limit: 1 ...

  9. 【补题记录】ZJU-ICPC Summer Training 2020 部分补题记录

    补题地址:https://zjusummer.contest.codeforces.com/ Contents ZJU-ICPC Summer 2020 Contest 1 by Group A Pr ...

随机推荐

  1. Java 8的这些新特性,不一样的全新版本(万字长文详细说明)

    目录 1.Lambda表达式 2.Stream API 2.1 入门介绍 2.2.什么是Stream流 2.3.Stream的创建 ①.通过Collection接口获取 ②.由数组创建流 ③.由值创建 ...

  2. 计算机图形学中使用Turbo C++画图步骤

    一.下载安装Turbo C++ 我安装的是Turbo C++ 3.2.2.0下载链接 二.画图 1.打开Turbo C++,点击右下角start turbo C++ 2.点击file ->new ...

  3. Android 之 手动创建活动

    •活动是什么 活动(Activity)是最容易吸引用户的地方,它是一种可以包含用户界面的组件: 主要用于和用户进行交互: 一个应用程序可以包含零个或多个活动. 接下来,我们来学习一下活动的基本用法. ...

  4. Java中的三大特性 - 超详细篇

    前言 大家好啊,我是汤圆,今天给大家带来的是<Java中的三大特性 - 超详细篇>,希望对大家有帮助,谢谢 这一节的内容可能有点多,大家可以选择性的来看 简介 Java的三大特性:封装.继 ...

  5. 提高Python的性能

    01 使用哈希表的数据结构   如果在程序中遇到大量搜索操作时,并且数据中没有重复项,则可以使用查找而不是循环.举例如下: items = ['a', 'b',..,'100m'] #1000s of ...

  6. Logstash生产环境实践手册(含grok规则示例和ELKF应用场景)

    ELKF应用场景: 1) datasource->logstash->elasticsearch->kibana 2) datasource->filebeat->log ...

  7. 翻译:《实用的Python编程》07_05_Decorated_methods

    目录 | 上一节 (7.4 装饰器) | 下一节 (8 测试和调试) 7.5 装饰方法 本节讨论一些与方法定义结合使用的内置装饰器. 预定义的装饰器 在类定义中,有许多预定义的装饰器用于指定特殊类型的 ...

  8. 《构建之法》& CI/CD调研

    项目 内容 这个作业属于哪个课程 2021春季软件工程(罗杰 任健) 这个作业的要求在哪里 2021年软工-个人阅读作业2 我在这个课程的目标是 提升软件开发能力与团队意识 这个作业在哪个具体方面帮助 ...

  9. MyBatis笔记(七)

    1. 简介 什么是缓存? 存在内存中的临时数据 将用户经常查询的数据存放在缓存(内存)中,用户取查询就不用从磁盘上(关系型数据库数据文件)查询,从缓存中查询,从而提高查询效率,解决了高并发系统的性能问 ...

  10. buuctf pwn wp---part1

    pwn难啊 1.test_your_nc 测试你nc,不用说,连上就有. 2.rip ida中已经包含了system函数: 溢出,覆盖rip为fun函数,peda计算偏移为23: from pwn i ...