这应该是我第二次打AtCoder, 题目其实并不难,就是自己经验不足想复杂了,再加上自己很笨,愣是做了97分钟才全做出来(最后三分钟,有点小激动。。),看着前面大牛半个小时都搞完了,真心膜拜一下,代码其实没什么可看的,题目也没什么可说的,就是为了贴出来总结经验,下次再战!

链接:http://abc072.contest.atcoder.jp/

A:直接做就可以了

  1. #include<bits/stdc++.h>
  2.  
  3. using namespace std;
  4. const int INF = ( << );
  5. const int N = + ;
  6. const double eps = 1e-;
  7. const int M = + ;
  8. const int MOD = 1e9;
  9.  
  10. char str[N];
  11. int main(){
  12. int x, t;
  13. scanf("%d %d", &x, &t);
  14. printf("%d\n", max(x - t, ));
  15. }

B:也是直接做就可以了

  1. #include<bits/stdc++.h>
  2.  
  3. using namespace std;
  4. const int INF = ( << );
  5. const int N = + ;
  6. const double eps = 1e-;
  7. const int M = + ;
  8. const int MOD = 1e9;
  9.  
  10. char str[N];
  11. int main(){
  12. scanf("%s", str);
  13. int len = strlen(str);
  14. for(int i = ; i < len; i += ) putchar(str[i]);
  15. puts("");
  16. }

C:只要考虑a[i+1] + a[i] + a[i+2]就可以了

  1. #include<bits/stdc++.h>
  2.  
  3. using namespace std;
  4. const int INF = ( << );
  5. const int N = + ;
  6. const double eps = 1e-;
  7. const int M = + ;
  8. const int MOD = 1e9;
  9.  
  10. int a[N];
  11. int main(){
  12. int n, ans = , x, maxn = ;
  13. scanf("%d", &n);
  14. for(int i = ; i <= n; i++){
  15. scanf("%d", &x); ++ a[x];
  16. if(x > maxn) maxn = x;
  17. }
  18. for(int i = ; i <= maxn; i++)
  19. ans = max(ans, a[i] + a[i + ] + a[i + ]);
  20. printf("%d\n", ans);
  21. }

D:没想到这么直接,直接swap就行了,我以为有什么套路结果卡着半天,最后还剩3分钟的时候直接交上去竟然AC了。。。神奇。。。

  1. #include<bits/stdc++.h>
  2.  
  3. using namespace std;
  4. const int INF = ( << );
  5. const int N = + ;
  6. const double eps = 1e-;
  7. const int M = + ;
  8. const int MOD = 1e9;
  9.  
  10. int a[N];
  11. int main(){
  12. int n, ans = ;
  13. scanf("%d", &n);
  14. for(int i = ; i <= n; i++) scanf("%d", &a[i]);
  15.  
  16. for(int i = ; i < n; i++)
  17. if(a[i] == i) swap(a[i], a[i + ]), ans++;
  18. if(a[n] == n) ans++;
  19. printf("%d\n", ans);
  20. }

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. luoguP2285 [HNOI2004]打鼹鼠 x

    P2285 [HNOI2004]打鼹鼠 题目描述 鼹鼠是一种很喜欢挖洞的动物,但每过一定的时间,它还是喜欢把头探出到地面上来透透气的.根据这个特点阿牛编写了一个打鼹鼠的游戏:在一个n*n的网格中,在某 ...

  2. 【BZOJ4552】排序(线段树,二分)

    题意:给定一个n个数的排列,有m次操作:op,l,r op=0时表示将位置[L,R]升序排序 op=1时表示将位置[L,R]降序排序 最后询问第q个位置上的数字 n,m,q<=1e5 思路:Fr ...

  3. Linux服务器pxe+kickstart部署无人值守安装

    一.    使用光盘镜像安装好一台Redhat6.8系统的虚拟机(图形化界面) 二.    部署相关服务程序 1.     安装并配置dhcpd服务程序 a)安装dhcp服务程序 b)对dhcp服务进 ...

  4. Android_(控件)Chronometer计时器

    Android Chronometer(计时器) 继承TextView,显示的是某个时间点开始以及之后的时间增加 运行截图 程序结构 package com.example.administrator ...

  5. Vue源码阅读一:说说vue.nextTick实现

    用法: 在下次 DOM 更新循环结束之后执行延迟回调.在修改数据之后立即使用这个方法,获取更新后的 DOM. 疑惑: 怎么实现的延迟回调 原理: JavaScript语言的一大特点就是单线程,同一个时 ...

  6. linux 系统的 cache 过大,解决方案

    linux buff/cache过大,清理脚本 2018年06月20日 13:44:53 taozhe666 阅读数:6500   三条指令: sync echo 1 > /proc/sys/v ...

  7. java期末总结

    java期末总结: java语言特点:1.简洁有效 2.可移植性 3.面向对象 4.解释型 5.适合分布式计算 6.拥有较好的性能 7.健壮.防患于未然 8.具有多线程处理能力 9.具有较高的安全性 ...

  8. LeetCode 49. 字母异位词分组(Group Anagrams)

    题目描述 给定一个字符串数组,将字母异位词组合在一起.字母异位词指字母相同,但排列不同的字符串. 示例: 输入: ["eat", "tea", "ta ...

  9. 物料批量盘点,调用其中两个BAPI BAPI_MATPHYSINV_COUNT BAPI_MATPHYSINV_CHANGECOUNT

    涉及两个BAPI:录入数量BAPI_MATPHYSINV_COUNT 修改数量:BAPI_MATPHYSINV_CHANGECOUNT REPORT  ZSC_133 NO STANDARD PAGE ...

  10. Delphi导出Excel的设置操作

    procedure CreatRepSheet(SheetName:String;PageSize,PageLay:Integer); {新建Excel工作簿.进行页面设置} begin {新建Exc ...