【HDOJ】2510 符号三角形
暴力打表。
#include <cstdio>
int a[]={,,,,,,,,,,,,,,,,,,,,,,,,};
int main() {
while (scanf("%d",a)!=EOF && *a)
printf("%d %d\n", *a, a[*a]);
return ;
}
/*
#include <cstdio>
#include <cstdlib>
#include <cstring> // '+':1 '-':0
#define MAXN 25
char a[MAXN];
char map[MAXN][MAXN];
int ans; void f(int i, int n) {
int j; if (i == n) {
int x, y; x = y = 0;
for (i=0; i<n; ++i) {
map[0][i] = a[i];
if (a[i])
++x;
else
++y;
}
for (i=1; i<n; ++i) {
for (j=0; j<n-i; ++j) {
if (map[i-1][j] ^ map[i-1][j+1]) {
map[i][j] = 0;
++y;
} else {
map[i][j] = 1;
++x;
}
}
} if (x == y)
++ans;
} else {
for (j=0; j<2; ++j) {
a[i] = j;
f(i+1, n);
}
}
} int main() {
int i; for (i=1; i<MAXN; ++i) {
ans = 0;
memset(a, 1, sizeof(a));
f(0, i);
printf("%d\n", ans);
} return 0;
}
*/
【HDOJ】2510 符号三角形的更多相关文章
- hdu 2510 符号三角形 (DFS+打表)
符号三角形 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submi ...
- HDU 2510 - 符号三角形
DFS后打表 #include <iostream> using namespace std; ,,,,,,,,,,,,,,,,,,,,,,,,}; int main() { int n; ...
- 符号三角形(hdu 2510 搜索+打表)
符号三角形 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submi ...
- 符号三角形_hdu_2510(深搜).java
http://acm.hdu.edu.cn/showproblem.php?pid=2510 Time Limit: 2000/1000 MS (Java/Others) Memory Limi ...
- OpenJudge 2990:符号三角形 解析报告
2990:符号三角形 总时间限制: 1000ms 内存限制: 65536kB 描述 符号三角形的第1行有n个由“+”和”-“组成的符号 ,以后每行符号比上行少1个,2个同号下面是”+“ ...
- 符号三角形——F
F. 符号三角形 Time Limit: 1000ms Memory Limit: 32768KB 64-bit integer IO format: Java class name: 符号 ...
- code vs 3376 符号三角形
3376 符号三角形 时间限制: 1 s 空间限制: 128000 KB 题目等级 : 黄金 Gold 题解 题目描述 Description 如下图是由14个“+”和14个“-”组 ...
- 【a502】符号三角形问题
Time Limit: 1 second Memory Limit: 32 MB [问题描述] 在一般情况下,符号三角形的第一行有n个符号.按照2个同号的下面是"+"号,2个异号的 ...
- hdoj 2202 最大三角形
题目大意:给定n(3<=n<=50000)个点,求其中任意三个点组成的三角形面积最大,输出该面积. 题目传送:http://acm.hdu.edu.cn/showproblem.php?p ...
随机推荐
- VS2012 无法启动IIS Express Web服务器的解决方案
本文转载:http://blog.csdn.net/hongleidy5000/article/details/22732621 打开VS2012解决方案资源管理器 -> 点选 Web 项目选择 ...
- nvl,空时的推断和取值
nvl NVL的概念 Oracle/PLSQL中的一个函数. 格式为: NVL( string1, replace_with) 功能:假设string1为NULL,则NVL函数返回replace_wi ...
- [Javascript] Writing conventional commits with commitizen
Because semantic-release requires a specific message format, it's easier to follow this convention u ...
- python 学习笔记 copy
浅copy >>> a=[1,2,3,[4,5,6]]>>> a[1, 2, 3, [4, 5, 6]]>>> a[3].append(7)> ...
- Qt知识点、疑难杂症的治疗
Q: QVariant 保存指针数据 A1: 1,使用QVariant::fromValue((void*)target)保存数据 2,使用(ShortcutItem*)(v.value<v ...
- C++转换函数
1. 赋值操作时把右操作数隐式转化为左操作数2. 通过普通单参数构造函数把其他类型的对象隐式转换为我们的类类型3. 通过转换函数operator type()这种成员函数可以把类类型转成其他类型,这样 ...
- ubuntu 安装 flash player
ubuntu 软件中心里的 flash , 虽说写的支持 chrome , 但安装总不管用 可运行以下两个命令, 再重启 chrome 浏览器 (注意,一定要把打开的浏览器全部关闭, 再打开才可以) ...
- codevs 3336 电话网络
#include<iostream> #include<cstdio> #include<cstring> #include<queue> #defin ...
- 【开源java游戏框架libgdx专题】-06-使用libgdx自带的日志方法
Application 接口提供了简单的日志记录,并且提供了颗粒度的控制. Gdx.app.log("MyTag", "my informative message&qu ...
- JAVA中的finalize()方法
[转]JAVA中的finalize()方法 今天早上看Thinking in java的[第四章 初始化和清除].[ 清除:终结和垃圾回收]的时候, 看到了这个东西. 用于清理滴... 当然,这个方 ...