2021.02.21cf补题
B. National Project
题意:总长度为n的公路进行维修,天气是有规律性的,连续g天的好天气,连续b天的坏天气,必须在好天气进行维护,问至少维护n的一半,那么至少需要多少天
思路:必须是g的整数倍和b的整数倍构成的天数,通过相除,假设g+b是一组,最后尾巴那算作单算
想法:1)这个数必须是g的整数倍和b的整数倍构成的,或者是直接输出n,这个限制条件是题目中没有提到,但是你必须写的
代码:

1 #include<iostream>
2 #include<algorithm>
3 #include<cstdio>
4 #include<cmath>
5 #include<cstring>
6 using namespace std;
7 const int maxx=1e5+10;
8 int main(){
9 int t;
10 scanf("%d",&t);
11 while(t--){
12 long long int a,b,c;
13 long long int aa;
14 scanf("%lld %lld %lld",&a,&b,&c);
15
16 aa=a;
17 if(a%2==1){
18 a/=2;
19 a++;
20 }else{
21 a/=2;
22 }
23
24 if(a%b==0){
25 long long int sum=0;
26 sum=a/b*(b+c);
27 sum-=c;
28 printf("%lld\n",max(sum,aa));
29 }else{
30 long long int sum=0;
31 sum=a/b*(b+c);
32 sum+=a%b;
33 printf("%lld\n",max(sum,aa));
34 }
35 }
36
37 }
A. Common Subsequence(Codeforces Round #658 (Div. 2))
题目:题目很混乱,直接题目模糊样例入手调查猜想
思路:找两个数组中有没有共同元素,如果有直接输出1和这个元素值,如果没有就直接输出NO
代码:

1 #include<iostream>
2 #include<algorithm>
3 #include<cstdio>
4 #include<cmath>
5 #include<cstring>
6 using namespace std;
7 int main(){
8 int t;
9 scanf("%d",&t);
10 while(t--){
11 int n,m;
12 scanf("%d %d",&n,&m);
13 int a[1500],b[1500];
14 for(int i=0;i<n;i++){
15 scanf("%d",&a[i]);
16 }
17 for(int i=0;i<m;i++){
18 scanf("%d",&b[i]);
19 }
20 int flag=0;
21 int ii=0,jj=0;
22 for(int i=0;i<n;i++){
23 flag=0;
24 for(int j=0;j<m;j++){
25 if(a[i]==b[j]){
26 flag=1;
27 ii=i;
28 jj=j;
29 break;
30 }
31 }
32 if(flag==1){
33 break;
34 }
35 }
36 if(flag==0){
37 printf("NO\n");
38 }else{
39 printf("YES\n");
40 printf("1 %d\n",a[ii]);
41 }
42 }
43 }
B. Sequential Nim
题目:取牌,分为先手和后手,问谁先取完
思路:就是看谁先取到第一个非1的数,谁就赢了
代码:

1 #include<iostream>
2 #include<algorithm>
3 #include<cstdio>
4 #include<cmath>
5 #include<cstring>
6 using namespace std;
7 const int maxx=1e5+10;
8 int main(){
9 int t;
10 scanf("%d",&t);
11 while(t--){
12 int n;
13 scanf("%d",&n);
14 int a[maxx];
15 int flag=0;
16 int sum=0;
17 for(int i=0;i<n;i++){
18 scanf("%d",&a[i]);
19 }
20 if(n==1){
21 printf("First\n");
22 continue;
23 }
24 for(int i=0;i<n;i++){
25 if(a[i]==1){
26 sum+=1;
27 }
28 if(a[i]!=1){
29 sum++;
30 break;
31 }
32 }
33 if(sum%2==1){
34 printf("First\n");
35 }else{
36 printf("Second\n");
37 }
38
39 }
40 }
2021.02.21cf补题的更多相关文章
- 2021.1.28--vj补题
B - B CodeForces - 994B 题内容: Unlike Knights of a Round Table, Knights of a Polygonal Table deprived ...
- 2021.3.10--vj补题
B - Saving the City cf--1443B Bertown is a city with nn buildings in a straight line. The city's sec ...
- 2021.3.3--vj补题
题目 C - C CodeForces - 1166C The legend of the foundation of Vectorland talks of two integers xx and ...
- 2021.2.23--vj补题
B - B CodeForces - 699B 题目: You are given a description of a depot. It is a rectangular checkered fi ...
- 2021.1.23--vj补题
B - B CodeForces - 879B n people are standing in a line to play table tennis. At first, the first tw ...
- hdu5017:补题系列之西安网络赛1011
补题系列之西安网络赛1011 题目大意:给定一个椭球: 求它到原点的最短距离. 思路: 对于一个椭球的标准方程 x^2/a^2 + y^2/b^2 +z^2/c^2=1 来说,它到原点的最短距离即为m ...
- 2017河工大校赛补题CGH and 赛后小结
网页设计课上实在无聊,便开始补题,发现比赛时候僵着的东西突然相通了不少 首先,"追妹"这题,两个队友讨论半天,分好多种情况最后放弃(可是我连题目都没看啊),今天看了之后试试是不是直 ...
- 2018 HDU多校第四场赛后补题
2018 HDU多校第四场赛后补题 自己学校出的毒瘤场..吃枣药丸 hdu中的题号是6332 - 6343. K. Expression in Memories 题意: 判断一个简化版的算术表达式是否 ...
- 2018 HDU多校第三场赛后补题
2018 HDU多校第三场赛后补题 从易到难来写吧,其中题意有些直接摘了Claris的,数据范围是就不标了. 如果需要可以去hdu题库里找.题号是6319 - 6331. L. Visual Cube ...
随机推荐
- 使用 autofac 实现 asp .net core 的属性注入
使用 autofac 代替 asp .net core 默认的 IOC 容器,可实现属性注入. 之前的使用方式不受影响. 源码已开源: dotnet-campus/Autofac.Annotation ...
- c/c++ switch case内括号
如果在case语句中有定义变量,则必须要加{},否则会报错.
- od快捷键
视图.查看相关: Alt+l 记录 Alt+e 可执行模块 Alt+m 内存 Alt+c cpu(反汇编视图) Ctrl+p 补丁 Alt+k 调用堆栈 Alt+b 断点 Alt+f5 设置窗口总在 ...
- maven-plugin-shade 详解
一.介绍 [1] This plugin provides the capability to package the artifact in an uber-jar, including its d ...
- INTERSPEECH2020 语音情感分析论文之我见
摘要:本文为大家带来InterSpeech2020 语音情感分析25篇论文中的其中8篇的总结. 本文分享自华为云社区<INTERSPEECH2020 语音情感分析论文总结一>,原文作者:T ...
- 前端vue使用高德地图
首先,注册Key 1.注册开发者账号,成为高德开放平台开发者 2.登陆之后,在进入「应用管理」 页面「创建新应用」 3.为应用添加 Key,「服务平台」一项请选择「 Web 端 ( JSAPI ) 」 ...
- HTML5是什么
HTML5是目前超文本标记语言 (Hyper Text Markup Language)最新修订版.HTML可以理解为一门程序语言,HTML5字面的意思,这门程序语言的第五次修订,也是HTML的第五个 ...
- 数据库MySQL一
P252 1.MySQL 最为主要使用的数据库 my sequel 不容易查找数据 DB数据库 存储数据的仓库,它保存了一系列有组织的数据 DBMS数据库管理系统,数据库是通过DBMS创建和操作的容器 ...
- [Skill]从零掌握正则表达式
前言 无论你是出于什么原因需要掌握正则表达式(诸如爬虫.文本检索.后端服务开发或Linux脚本),如果之前从没接触过正则表达式(比如我)很容易在如山般的公式中迷失,以至于你在项目写的正则表达式很可能会 ...
- 【项目】手写FTP服务器-C++实现FTP服务器
X_FTP_server 手写FTP服务器-C++实现FTP服务器 项目Gitee链接:https://gitee.com/hsby/ftp_Server 简介 一个基于libevent的高并发FTP ...