A.CodeForces-124A

(简单数学题)

  1. #include<cstdio>
  2. #include<algorithm>
  3. #include<iostream>
  4. #include<cmath>
  5. using namespace std;
  6. int main(){
  7. int a,b,n;
  8. scanf("%d %d %d",&n,&a,&b);
  9. if((n-a)>b){
  10. printf("%d",b+1);
  11. }else{
  12. printf("%d",n-a);
  13. }
  14. }

D.cAPS

要么只包含大写字母,要么除了第一个字母外都是大写,才进行变化,否则输出原来字符串

多注意题目要求,仔细读题。

  1. 1 #include<stdio.h>
  2. 2 #include<string.h>
  3. 3 int main(){
  4. 4 char s[110];
  5. 5 gets(s);
  6. 6 int len;
  7. 7 len=strlen(s);
  8. 8 int flag=0;
  9. 9 for(int i=1;i<len;i++){
  10. 10 if(s[i]>='a'&&s[i]<='z'){
  11. 11 flag=1;
  12. 12 break;
  13. 13 }
  14. 14 }
  15. 15 if(flag==1){
  16. 16 puts(s);
  17. 17
  18. 18 }else{
  19. 19 for(int i=0;i<len;i++){
  20. 20 if(s[i]>='a'&&s[i]<='z'){
  21. 21 printf("%c",s[i]-'a'+'A');
  22. 22 }else{
  23. 23 printf("%c",s[i]-'A'+'a');
  24. 24 }
  25. 25 }
  26. 26 }
  27. 27
  28. 28 }

E.Opposites Attract

数学问题,相反数的个数相乘即可,但是注意0需要特判,数字和数组也要开__int64

  1. 1 #include<cstdio>
  2. 2 #include<cstring>
  3. 3 #include<algorithm>
  4. 4 #include<cmath>
  5. 5 using namespace std;
  6. 6 __int64 a[11]={0},b[11]={0};
  7. 7 int main(){
  8. 8 __int64 n,m,sum=0;
  9. 9 scanf("%I64d",&n);
  10. 10
  11. 11 for(int i=0;i<n;i++){
  12. 12 scanf("%I64d",&m);
  13. 13 if(m>0){
  14. 14 a[m]++;
  15. 15 }else{
  16. 16 b[-m]++;
  17. 17 }
  18. 18 }
  19. 19 for(int i=0;i<=10;i++){
  20. 20 sum+=(a[i]*b[i]);
  21. 21 }
  22. 22 if(b[0]>1){
  23. 23 sum+=(b[0]*(b[0]-1))/2;
  24. 24 }
  25. 25 printf("%I64d",sum);
  26. 26 }

F.The World IS A Theatre

组合数学问题

  1. 1 #include<cstdio>
  2. 2 #include<cstring>
  3. 3 #include<algorithm>
  4. 4 #include<cmath>
  5. 5 using namespace std;
  6. 6 __int64 calcu(__int64 a,__int64 b);
  7. 7 int main(){
  8. 8 __int64 m,n,sum=0,t;
  9. 9 scanf("%I64d %I64d %I64d",&n,&m,&t);
  10. 10 for(int i=4;i<=t-1;i++){
  11. 11 sum+=(calcu(n,i)*calcu(m,t-i));
  12. 12 }
  13. 13 printf("%I64d",sum);
  14. 14
  15. 15 }
  16. 16 __int64 calcu(__int64 a,__int64 b){
  17. 17 __int64 i,item=1;
  18. 18 if(b>a) return 0;
  19. 19 int j=min(a-b,b);
  20. 20 for(i=1;i<=j;i++){
  21. 21 item*=a;
  22. 22 a--;
  23. 23 item/=i;
  24. 24
  25. 25 }
  26. 26 return item;
  27. 27
  28. 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字符串==和equals的区别

    首先我们来了解一下String类,Java的字符串是一旦被赋值之后无法更改的(这里的无法更改是指不能将字符串中单个或一段字符重新赋值),这也是Java虚拟机为了减少内存开销,避免字符串的重复创建设立的 ...

  2. 在B站刷视频多倍速操作

    B站多倍数播放 1. 最初天真版 F12 或者笔记本(Fn+F12) console控制台 输入 document.querySelector('video').playbackRate = 4: - ...

  3. MySQL5.7和MySQL8.0通用配置文件

    MySQL5.7 my.cnf配置 [client] port=3306 socket=/log/mysql/mysql.sock [mysql] socket=/log/mysql/mysql.so ...

  4. java面试-CountDownLatch、CyclicBarrier、Semaphore谈谈你的理解

    一.CountDownLatch 主要用来解决一个线程等待多个线程的场景,计数器不能循环利用 public class CountDownLatchDemo { public static void ...

  5. 中小型前端团队代码规范工程化最佳实践 - ESLint

    前言 There are a thousand Hamlets in a thousand people's eyes. 一千个程序员,就有一千种代码风格.在前端开发中,有几个至今还在争论的代码风格差 ...

  6. Dynamics CRM实体系列之视图

    这一节开始讲视图.视图在Dynamics CRM中代表着实体的数据展示列表,通过这个列表可以对数据进行一个初步预览,也可以进行一些数据的定向筛选和搜索进行精确的浏览一部分数据.同时视图也是查看详细实体 ...

  7. Java JVM 启动参数

    JVM 启动参数 java -Xmx4096m // 设置JVM最大可用内存为4096m. -Xms4096m // 设置JVM促使内存为4096m.此值可以设置与-Xmx相同,以避免每次垃圾回收完成 ...

  8. 我与Git的那些破事(下)--分支模型

    在上篇文章中,我提到了Git的基本概念和一些本人实际项目中的总结.然而,最近读了Vincent Driessen写的一篇文章,觉得他总结的太好了,站在他肩膀上忍不住将自己的理解分享出来.Vincent ...

  9. Day13_70_join()

    join() 方法 * 合并线程 join()线程合并方法出现在哪,就会和哪个线程合并 (此处是thread和主线程合并), * 合并之后变成了单线程,主线程需要等thread线程执行完毕后再执行,两 ...

  10. 【C】EM卡韦根32/24格式卡号转换的实现

    写在前面 第八周实验报告的deadline马上就要到了,大家都在奋笔疾书.这次的实验报告中有一个十分秃然的任务,要求学生用C语言编写一段代码,来处理编码问题. 我的ddl是在第七周,所以较早地解决了这 ...