栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

zoj 3347 Picture Handling

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

zoj 3347 Picture Handling

#include <cstdio>#include <cstring>#include <cmath>#include <iostream>#include <algorithm>#define MAXN 300#define MAXM 101000using namespace std;const double eps = 1e-9;int w, h, m;long long ma[MAXN][MAXN];struct que { int x1, x2, y1, y2, kind;} all[MAXM];int main() { while (scanf("%d %d", &w, &h) == 2) { for (int i = 0; i < h; i++) for (int j = 0; j < w; j++) scanf("%lldn", ma[i] + j); int m; scanf("%d", &m); for (int i = 0; i < m; i++) scanf("%d %d %d %d %d", &all[i].x1, &all[i].y1, &all[i].x2, &all[i].y2, &all[i].kind); int x, y; long long ans = 0, hao = 1; scanf("%d %d", &x, &y); for (int i = m - 1; i >= 0; i--) { if (x >= all[i].x1 && x <= all[i].x2 && y >= all[i].y1 && y <= all[i].y2) { if (all[i].kind == 1) { hao *= -1; } else if (all[i].kind == 2) { ans += hao; } else if (all[i].kind == 3) { ans -= hao; } else if (all[i].kind == 4) { x = all[i].x1 + all[i].x2 - x; } else { y = all[i].y1 + all[i].y2 - y; } } } ans+=hao*ma[y][x]; cout<<ans<<endl; }}
转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/367999.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号