UVALive-7512-November 11th
来源:互联网 发布:雷锋的故事动画片知乎 编辑:程序博客网 时间:2024/05/21 17:51
ACM模版
描述
题解
规律题。直接看代码吧,十分好理解。
代码
#include <cstdio>#include <iostream>#include <cstring>using namespace std;const int MAXN = 1111;int T;int r, c;int seat[MAXN][MAXN];int main(){ scanf("%d", &T); for (int ce = 1; ce <= T; ce++) { scanf("%d%d", &r, &c); memset(seat, 0, sizeof(seat)); int m; scanf("%d", &m); int br, bc; for (int i = 0; i < m; ++i) { scanf("%d%d", &br, &bc); seat[br][bc] = 1; } int ans_more = 0; int ans_less = 0; for (int i = 0; i < r; ++i) { int cur = 0; for (int j = 0; j < c; ++j) { if (seat[i][j] == 0) { ++cur; } if (seat[i][j] == 1 || j == c - 1) { if (cur == 1) { ++ans_more; ++ans_less; } else { if (cur % 2 == 0) { ans_more += cur / 2; } else { ans_more += cur / 2 + 1; } if (cur % 3) { ans_less += cur / 3 + 1; } else { ans_less += cur / 3; } } cur = 0; } } } printf("Case #%d: %d %d\n", ce, ans_more, ans_less); } return 0;}
阅读全文
0 0
- UVALive 7512 November 11th
- UVALive 7512 November 11th
- UVALive 7512November 11th
- UVALive-7512-November 11th
- November 11th UVALive
- UVALive 7512 November 11th(脑洞)
- ECfinal UVALive 7512 November 11th (公式)
- UVALive 7512 November 11th(模拟, 思维)
- November 11th Wednesday
- UVA7512 November 11th (思路)
- November 3th Tuesday
- November 5th Thursday
- November 9th Monday
- November 12th Thursday
- November 13th Friday
- November 14th Saturday
- November 15th Sunday
- November 16th Monday
- 查看手机进程oom_adj值
- 6.11
- HDU 5410 CRB and His Birthday
- Retrofit请求数据 多线程下载 Ijkplayer视频播放
- 牛客网PAT题目1002——数字分类(Java)
- UVALive-7512-November 11th
- socket在linux和windows下的差异
- C#读取目录下的所有视频
- Java ArrayList的自定义排序
- where does ansroid.os.SystemProperties store its key/values?
- Centos7忘记密码重置root密码
- ASP.NET控件(gridview datalist等等 )后台绑定数据
- 【Scikit-Learn 中文文档】2 使用 scikit-learn 介绍机器学习 | ApacheCN
- angular js 综合 循环死数据 全选/反选 过滤 批量删除 提交数据(判断空值) 排序