Good Bye 2015
来源:互联网 发布:unity3d 联机unet 编辑:程序博客网 时间:2024/06/18 05:00
传送门:
http://codeforces.com/contest/611/problem/A
这题刚开始写的时候是硬算的,由于马虎把星期日算错了,其实直接暴力就ok了
// Days (A), by Errichto#include<bits/stdc++.h>using namespace std;int t[12] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};int main() { int x; scanf("%d", &x); char sl[15]; scanf("%s", sl); scanf("%s", sl); if(sl[0] == 'w') { int current = 5; int ans = 0; for(int i = 0; i < 366; ++i) { if(current == x) ++ans; ++current; if(current > 7) current = 1; } printf("%d\n", ans); return 0; } int c = 0; for(int i = 0; i < 12; ++i) c += x <= t[i]; printf("%d\n", c); return 0;}
传送门:
http://codeforces.com/contest/611/problem/B
这道题目我的想法是和标解一样的,但是实际打的时候1个是没写1LL,1个是在用dev的时候用了%64d,坑啊,调试了好长时间,最后是因为这个原因导致输入的r区间刚开始就是错的,
下次调试的时候一定要注意这一点了,中间加上输出也是十分必要的,还有就是有的时候加法和减法一定要挑方便的用,比如这道题就应该用减法,我写的就是分丑陋
// One zero, by Errichto// O(log^2(n))#include<bits/stdc++.h>using namespace std;int main() { long long a, b; scanf("%lld%lld", &a, &b); int c = 0; for(int i = 0; (1LL << i) / 2 <= b; ++i) for(int j = 0; j <= i - 2; ++j) { long long x = (1LL << i) - 1 - (1LL << j); c += a <= x && x <= b; } printf("%d\n", c); return 0;}
0 0
- cf good bye 2015
- Codeforces Good Bye 2015
- Good Bye 2015 A
- Good Bye 2015B
- Good Bye 2015
- Good Bye 2015
- Codeforces Good Bye 2015 ABCDE
- 【DP】good bye 2015 D
- Good Bye 2015-------补题
- codeforces Good Bye 2015 B
- good bye
- GOOD BYE
- Good Bye.
- Good Bye 2015 B. 位运算
- Good Bye MFC?
- Good bye 2004.
- Good Bye Lenin!
- Good Bye, PDA?[收藏]
- 计算机书籍的一点总结
- Java多线程编程
- 重写equals和hashcode
- 后端服务(综合)
- 自定义视图与工厂模式
- Good Bye 2015
- 大数据(四) - MapReduce
- Java笔记14:泛型初探
- iOS 一个方法 解决四舍五入
- 【bzoj3239】Discrete Logging BSGS
- Fragment碎片用法
- 蓝色多瑙河
- Java读写文件
- SourceInsight的实用设置