A:

  给你一个矩阵求'/' 和 '\' 围成的图形,简单签到题,有一些细节要考虑。

  题解:一行一行的跑,遇到'/'和'\' 就加0.5, 在面积里面的'.' 就加1.用一个flag来判断是否在围住的图形里面。

 #include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#include <queue>
#include <map>
#include <stack>
#include <set>
using namespace std;
typedef long long LL;
typedef unsigned long long uLL;
#define ms(a, b) memset(a, b, sizeof(a))
#define pb push_back
#define mp make_pair
#define eps 0.0000000001
#define IOS ios::sync_with_stdio(0);cin.tie(0);
const LL INF = 0x3f3f3f3f3f3f3f3f;
const int inf = 0x3f3f3f3f;
const int maxn = +;
const int mod = 1e9+;
char s[maxn][maxn];
int main() {
#ifdef LOCAL
freopen("input.txt", "r", stdin);
// freopen("output.txt", "w", stdout);
#endif
// IOS freopen("ascii.in", "r", stdin);
freopen("ascii.out", "w", stdout); int h, w;
scanf("%d%d", &h, &w);
for(int i = ;i<h;i++) scanf("%s", s[i]); double ans = ;
for(int i = ;i<h;i++){
int flag = ;
for(int j = ;j<w;j++){
if((s[i][j]=='/'||s[i][j]=='\\')&&flag==){
flag = ;
ans += 0.5;
}
else if(s[i][j]=='.'&&flag){
ans+=1.0;
}
else if((s[i][j]=='/'||s[i][j]=='\\')&&flag){
flag = ;
ans += 0.5;
}
}
// printf("%.0f\n", ans);
}
printf("%.0f\n", ans);
return ;
}

最新文章

  1. C语言基础--函数
  2. struts2整合CKEditor和CKFinder实现上传
  3. file_get_content和curl的性能比较
  4. Java实现猜数游戏
  5. 如何下载到最新的版本的Oracle Database
  6. C语言学习的经典书籍--转载
  7. 转:JavaScript定时机制、以及浏览器渲染机制 浅谈
  8. 立贴读 《CLR》
  9. POJ 3122 &amp; 3258 &amp; 3273 #二分
  10. 依赖于boodtrap3的插件推荐以及bootrap发展前景
  11. [OC] UIcollectionView 与 UIcollectionViewCell 的使用
  12. java.lang.IllegalStateException: ApplicationEventMulticaster not initialized - call &#39;refresh&#39; before multicasting events via the context 错误
  13. glance系列一:glance基础
  14. Windows PowerShell 入門(9)-エラー編
  15. qsort例子
  16. 关于Linux一些问题和答案
  17. spring之继承配置
  18. 2018.11.06 洛谷P1099 树网的核(最短路+枚举)
  19. python测试开发django-42.auth模块登陆认证
  20. [转]servlet配置中init-param

热门文章

  1. DataFrame.to_dict(orient=&#39;dict&#39;)
  2. Jinja2 中文手册
  3. 浏览器给openresty连接发送参数请求,查询数据库,并返回json数据
  4. 20.AutoMapper 之理解你的映射(Understanding Your Mappings)
  5. SIP协议 会话发起协议(二)
  6. Linux-定时任务排查
  7. 006-saltstack之远程执行
  8. Linux中配置jdk环境变量出错:bad ELF interpreter: No such file or directory解决方法
  9. Android开发艺术探索笔记之Activity
  10. 费用流 Dijkstra 原始对偶方法(primal-dual method)