这应该是我第二次打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的更多相关文章

  1. AtCoder Beginner Contest 100 2018/06/16

    A - Happy Birthday! Time limit : 2sec / Memory limit : 1000MB Score: 100 points Problem Statement E8 ...

  2. AtCoder Beginner Contest 052

    没看到Beginner,然后就做啊做,发现A,B太简单了...然后想想做完算了..没想到C卡了一下,然后还是做出来了.D的话瞎想了一下,然后感觉也没问题.假装all kill.2333 AtCoder ...

  3. AtCoder Beginner Contest 053 ABCD题

    A - ABC/ARC Time limit : 2sec / Memory limit : 256MB Score : 100 points Problem Statement Smeke has ...

  4. AtCoder Beginner Contest 136

    AtCoder Beginner Contest 136 题目链接 A - +-x 直接取\(max\)即可. Code #include <bits/stdc++.h> using na ...

  5. AtCoder Beginner Contest 137 F

    AtCoder Beginner Contest 137 F 数论鬼题(虽然不算特别数论) 希望你在浏览这篇题解前已经知道了费马小定理 利用用费马小定理构造函数\(g(x)=(x-i)^{P-1}\) ...

  6. AtCoder Beginner Contest 076

    A - Rating Goal Time limit : 2sec / Memory limit : 256MB Score : 100 points Problem Statement Takaha ...

  7. AtCoder Beginner Contest 079 D - Wall【Warshall Floyd algorithm】

    AtCoder Beginner Contest 079 D - Wall Warshall Floyd 最短路....先枚举 k #include<iostream> #include& ...

  8. AtCoder Beginner Contest 064 D - Insertion

    AtCoder Beginner Contest 064 D - Insertion Problem Statement You are given a string S of length N co ...

  9. AtCoder Beginner Contest 075 D - Axis-Parallel Rectangle【暴力】

    AtCoder Beginner Contest 075 D - Axis-Parallel Rectangle 我要崩溃,当时还以为是需要什么离散化的,原来是暴力,特么五层循环....我自己写怎么都 ...

随机推荐

  1. Springboot入门实战, 使用@Value

    今天开始最简单的Springboot应用 entity.Book package com.draymonder.amor.entity; import java.util.List; import o ...

  2. CodeForces451E Devu and Flowers

    题目链接 问题分析 没有想到母函数的做法-- 其实直接看题思路挺简单的.发现如果每种花都有无限多的话,问题变得十分简单,答案就是\(s+n-1\choose n - 1\).然后发现\(n\)只有\( ...

  3. ajax异步加载查询数据库

    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/ ...

  4. xpath元素定位方法

    XPath 使用路径表达式来选取 XML 文档中的节点或者节点集.这些路径表达式和我们在常规的电脑文件系统中看到的表达式非常相似.XPath 含有超过 100 个内建的函数.这些函数用于字符串值.数值 ...

  5. redis哨兵集群搭建

    下载redis jar包redis-4.0.11.tar.gz放在/data/redis目录下 解压 命令:tar -zxvf redis-4.0.11.tar.gz 解压后如图所示 在/usr/lo ...

  6. 查询Oracle表空间使用情况

    ,),'990.99')||'%' "使用比(%)",F.TOTAL_BYTES "空闲空间(M)",F.MAX_BYTES "最大块(M)" ...

  7. leetcode-easy-others-268 Missing Number

    mycode   80.25% class Solution(object): def missingNumber(self, nums): """ :type nums ...

  8. WireShark简单使用以及TCP三次握手

    最近一直在用C#编写服务器端的程序,苦于一直找不到合适的方法来测试网络程序,这篇文章很好的解释了网络程序的底层实现. WireShark是最好的学习网络协议最好的工具. wireshark介绍 wir ...

  9. KVM 开启嵌套虚拟化

    问题 在 CentOS KVM 上启动虚拟机来部署 OpenStack 测试环境,在启动具有 CPU 绑定.NUMA 亲和的虚拟机时触发错误: libvirtError: Requested oper ...

  10. apache虚拟目录配置实例

    apache虚拟目录配置实例 一.首先,开启虚拟主机配置 在文件httpd.conf中找到: include conf/extra/httpd-vhosts.conf #开启 二.对httpd-vho ...