AtCoder Beginner Contest 072
这应该是我第二次打AtCoder, 题目其实并不难,就是自己经验不足想复杂了,再加上自己很笨,愣是做了97分钟才全做出来(最后三分钟,有点小激动。。),看着前面大牛半个小时都搞完了,真心膜拜一下,代码其实没什么可看的,题目也没什么可说的,就是为了贴出来总结经验,下次再战!
链接:http://abc072.contest.atcoder.jp/
A:直接做就可以了
#include<bits/stdc++.h> using namespace std;
const int INF = ( << );
const int N = + ;
const double eps = 1e-;
const int M = + ;
const int MOD = 1e9; char str[N];
int main(){
int x, t;
scanf("%d %d", &x, &t);
printf("%d\n", max(x - t, ));
}
B:也是直接做就可以了
#include<bits/stdc++.h> using namespace std;
const int INF = ( << );
const int N = + ;
const double eps = 1e-;
const int M = + ;
const int MOD = 1e9; char str[N];
int main(){
scanf("%s", str);
int len = strlen(str);
for(int i = ; i < len; i += ) putchar(str[i]);
puts("");
}
C:只要考虑a[i+1] + a[i] + a[i+2]就可以了
#include<bits/stdc++.h> using namespace std;
const int INF = ( << );
const int N = + ;
const double eps = 1e-;
const int M = + ;
const int MOD = 1e9; int a[N];
int main(){
int n, ans = , x, maxn = ;
scanf("%d", &n);
for(int i = ; i <= n; i++){
scanf("%d", &x); ++ a[x];
if(x > maxn) maxn = x;
}
for(int i = ; i <= maxn; i++)
ans = max(ans, a[i] + a[i + ] + a[i + ]);
printf("%d\n", ans);
}
D:没想到这么直接,直接swap就行了,我以为有什么套路结果卡着半天,最后还剩3分钟的时候直接交上去竟然AC了。。。神奇。。。
#include<bits/stdc++.h> using namespace std;
const int INF = ( << );
const int N = + ;
const double eps = 1e-;
const int M = + ;
const int MOD = 1e9; int a[N];
int main(){
int n, ans = ;
scanf("%d", &n);
for(int i = ; i <= n; i++) scanf("%d", &a[i]); for(int i = ; i < n; i++)
if(a[i] == i) swap(a[i], a[i + ]), ans++;
if(a[n] == n) ans++;
printf("%d\n", ans);
}
AtCoder Beginner Contest 072的更多相关文章
- AtCoder Beginner Contest 100 2018/06/16
A - Happy Birthday! Time limit : 2sec / Memory limit : 1000MB Score: 100 points Problem Statement E8 ...
- AtCoder Beginner Contest 052
没看到Beginner,然后就做啊做,发现A,B太简单了...然后想想做完算了..没想到C卡了一下,然后还是做出来了.D的话瞎想了一下,然后感觉也没问题.假装all kill.2333 AtCoder ...
- AtCoder Beginner Contest 053 ABCD题
A - ABC/ARC Time limit : 2sec / Memory limit : 256MB Score : 100 points Problem Statement Smeke has ...
- AtCoder Beginner Contest 136
AtCoder Beginner Contest 136 题目链接 A - +-x 直接取\(max\)即可. Code #include <bits/stdc++.h> using na ...
- AtCoder Beginner Contest 137 F
AtCoder Beginner Contest 137 F 数论鬼题(虽然不算特别数论) 希望你在浏览这篇题解前已经知道了费马小定理 利用用费马小定理构造函数\(g(x)=(x-i)^{P-1}\) ...
- AtCoder Beginner Contest 076
A - Rating Goal Time limit : 2sec / Memory limit : 256MB Score : 100 points Problem Statement Takaha ...
- AtCoder Beginner Contest 079 D - Wall【Warshall Floyd algorithm】
AtCoder Beginner Contest 079 D - Wall Warshall Floyd 最短路....先枚举 k #include<iostream> #include& ...
- AtCoder Beginner Contest 064 D - Insertion
AtCoder Beginner Contest 064 D - Insertion Problem Statement You are given a string S of length N co ...
- AtCoder Beginner Contest 075 D - Axis-Parallel Rectangle【暴力】
AtCoder Beginner Contest 075 D - Axis-Parallel Rectangle 我要崩溃,当时还以为是需要什么离散化的,原来是暴力,特么五层循环....我自己写怎么都 ...
随机推荐
- poj 3685 Matrix 二分套二分 经典题型
Matrix Time Limit: 6000MS Memory Limit: 65536K Total Submissions: 5724 Accepted: 1606 Descriptio ...
- .net core 在服务器端获取api传递的参数
在 ActionFilterAttribute 的OnActionExecutionAsync 中使用如下代码从流中读取用户参数 //从文件流中读取传递测参数 using (var ms = new ...
- R_Studio(学生成绩)使用主成分分析实现属性规约
对11_1_4.csv成绩表进行主成分分析处理 setwd('D:\\data') list.files() #读取数据 dat=read.csv(file="11_1_4.csv" ...
- linux查看端口占用情况,python探测端口使用的小程序
Linux如何查看端口 1.lsof -i:端口号 用于查看某一端口的占用情况,比如查看8000端口使用情况,lsof -i:8000 # lsof -i:8000 COMMAND PID USER ...
- 在Idea下配置Maven
Idea 自带了apache maven,默认使用的是内置maven,所以我们可以配置全局setting,来调整一下配置,比如远程仓库地址,本地编译环境变量等. 使用IDEA自带的maven时,若不配 ...
- hdfs、zookeepeer之HA模式
HA简介 1.所谓HA,即高可用(high available) 2.消除单点故障,避免集群瘫痪,hdfs中namenode保存了整个集群的元数据,如果namenode所在机器宕机,则整个集群瘫痪,H ...
- echarts_04
通过ajax加载本地文件: 1.http://www.cnblogs.com/qjqcs/archive/2016/09/07/5850282.html 2.http://blog.csdn.net/ ...
- MQ常问的问题
目录 1:什么场景使用了mq?直接掉接口不行吗? 2:用消息队列都有什么优点和缺点? 3:Kafka.ActiveMQ.RabbitMQ.RocketMQ 都有什么区别? 4:那你们是如何保证消息队列 ...
- 黑马lavarel教程---4、csrf验证及相关
黑马lavarel教程---4.csrf验证及相关 一.总结 一句话总结: csrf验证就像短信验证码那样验证用户身份,这个验证是为了验证是本站的操作,用的是一个token字符串,外站如果有了这个to ...
- jquery 四舍五入小数处理总结
一.jquery中对小数进行取整.四舍五入的方法 1.丢弃小数部分,保留整数部分 parseInt(5/2) =2 2.四舍五入. Math.round(5/2) =3 3.向下取整 Math.flo ...