UVa 1641 ASCII Area】的更多相关文章

题意: 就是用一个字符矩阵代表一个闭合的阴影部分,然后求阴影部分的面积. 分析: 一个'/'和'\'字符都代表半个小方块的面积. 关键就是判断'.'是否属于阴影部分,这才是本题的关键. 从第一列开始,从上到下扫面'/'和'\'字符的个数,如果是奇数,则'.'属于阴影部分,阴影面积加一. #include <cstdio> + ; char map[maxn][maxn]; int main() { //freopen("in.txt", "r", std…
题意:给定一个矩阵,里面有一个多边形,求多边形的面积. 析:因为是在格子里,并且这个多边形是很规则的,所以所有格子不是全属于多边形就是全不属于,或者一半,并且我们可以根据"/"和“\”的数目来知道,如果是奇数,那么就是属于, 偶数就是不属于. 代码如下: #pragma comment(linker, "/STACK:1024000000,1024000000") #include <cstdio> #include <string> #in…
A: 给你一个矩阵求'/' 和 '\' 围成的图形,简单签到题,有一些细节要考虑. 题解:一行一行的跑,遇到'/'和'\' 就加0.5, 在面积里面的'.' 就加1.用一个flag来判断是否在围住的图形里面. #include <iostream> #include <cstdio> #include <cstring> #include <string> #include <algorithm> #include <cmath> #…
遍历一遍,遇到边界为奇数次时,格子在多边形内 偶数次时,在多边形外 #include<cstdio> #define REP(i, a, b) for(int i = (a); i < (b); i++) using namespace std; int main() { char s[105]; int n, m; while(~scanf("%d%d", &n, &m)) { int ans = 0, c = 0; REP(i, 0, n) { i…
题意:判断两个多边形是否有面积大于0的公共部分 思路:扫描线基础. #pragma comment(linker, "/STACK:10240000") #include <bits/stdc++.h> using namespace std; #define X first #define Y second #define pb push_back #define mp make_pair #define all(a) (a).begin(), (a).end() #de…
Background from Wikipedia: “Set theory is a branch of mathematics created principally by the German mathematician Georg Cantor at the end of the 19th century. Initially controversial, set theory has come to play the role of a foundational theory in m…
思路:海伦公式, AC代码: #include<bits/stdc++.h> using namespace std; int main() { int n; scanf("%d",&n); double ha, hb, hc, a, b, c; while(~scanf("%lf %lf %lf",&ha,&hb,&hc)) { a = 2.0 / ha; b = 2.0 / hb ; c = 2.0 / hc; if(…
题目来源:https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=3&page=show_problem&problem=45  SCUD Busters  Background Some problems are difficult to solve but have a simplification that is easy to solve. Rather than…
http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=2119 11178 - Morley's Theorem Time limit: 3.000 seconds Problem DMorley’s TheoremInput: Standard Input Output: Standard Output Morley’s theorem stat…
Cellular Network Time Limit:3000MS     Memory Limit:0KB     64bit IO Format:%lld & %llu Submit Status Practice UVA 1456 A cellular network is a radio network made up of a number of cells each served by a base station located in the cell. The base sta…