这应该是我第二次打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);
}

最新文章

  1. The Towers of Hanoi Revisited---(多柱汉诺塔)
  2. Python中的sort()方法使用基础
  3. bjfu1299 stl使用
  4. 在Window IIS中安装运行node.js应用—你疯了吗
  5. wcf异常汇总
  6. javaWEB总结(8):自定义GenericServlet
  7. Token验证失败的解决方法
  8. RIDE的使用
  9. web从入门开始(6)-----框架
  10. 使用RandomAccessFile在两个java进程之间传递数据
  11. MyEclipse2016统一字符编码
  12. 易卡易APP的出现改变你的消费习惯
  13. “Swift Language Version” (SWIFT_VERSION) build setting must be set to a supported value for targets which use Swift
  14. ReentrantLock+线程池+同步+线程锁
  15. python-给微信好友自动发送天气预报和每日一句
  16. Windows 启用/禁用内置管理员 Administrator
  17. 08.vue中样式-class
  18. JS面试题(一)
  19. Restful framework【第三篇】序列化组件
  20. 题解——HDU 2089 不要62(数位DP)

热门文章

  1. 【BZOJ3545&amp;BZOJ3551】Peaks(kruskal重构树,主席树,dfs序)
  2. TCP如何保证可靠传输
  3. (LeetCode)1114. 按序打印
  4. JS框架_(JQuery.js)带阴影贴纸标签按钮
  5. 分布式-信息方式-ActiveMQ的Destination高级特性3
  6. 2018-2019-2 网络对抗技术 20165232 Exp 9 Web安全基础
  7. 获取&lt;a&gt;标签值&lt;/a&gt;的标签值及更改
  8. shell sed应用
  9. 软件结构B/S和C/S
  10. Python学习笔记:使用request库遇到的问题