题目链接:点击打开链接
题意:
给出闹钟的n个指针当前所指的角度
求2个闹钟通过旋转后能否相同
思路:
先排个序保证偏序的关系,然后坐差,
枚举第二个串的哪一位和第一个串的第一字符匹配,然后hash判断
#include
#include
#include
#include
#include
template
inline bool rd(T &ret)...
分类:
其他好文 时间:
2015-04-30 16:19:54
阅读次数:
124
分析:最长子序列的变种;另外长方体可以有三种放法,三种放法都存在同一个数组里面,因为每种长方体可以有无限个。
#include
#include
using namespace std;
struct BOX
{
int x,y,z;
} box[100];
int dp[100];
bool cmp(BOX a,BOX b)
{
if(a.x>b.x) return true;
e...
分类:
其他好文 时间:
2015-04-30 14:24:20
阅读次数:
131
六、分支:(一)if (表达式){}说明:1.表达式,就是用来返回bool形的表达式。2.if的小括号后面千万不要加分号(二)if(表达式){}else{}例:1.输入年龄,大于等于18显示成年,否则显示未成年。 思路:(1).从键盘接受一个数字(2).判断是否满足上面的条件 ye...
1.BOOL 类型实际上是#define YES 1 #define NO 0 所以实际上是一个整型类型2.实例变量的命名规范是加下划线,比如_name3.在.h文件中声明对象的方法:-(BOOL)方法名1:(NSString *)参数名1 方法名2:(NSInteger)参数名24.#pragma...
分类:
其他好文 时间:
2015-04-30 12:16:52
阅读次数:
96
#include
#include
#include
using namespace std;
struct node
{
char name[90],place[90];
int num;
}c[105];
bool cmp(node x,node y)
{
if(strcmp(x.place,y.place)<0) return true;
if(strcmp(x.place,...
分类:
编程语言 时间:
2015-04-30 10:39:46
阅读次数:
162
对单链表实现如下功能:
void InitList(List *list); //初始化单链表
bool push_back(List *list,ElemType x); //尾插法
void show_seqlist(List *list); //显示链表内容
bool push_front(List *list,ElemType x);//头插法
b...
分类:
其他好文 时间:
2015-04-30 01:00:56
阅读次数:
102
python的核心数据类型(内置)数字:int,long,float,complex(复数),bool(布尔型)字符:str,unicode列表:list字典:dict元组:tuple文件:file其他的类型:集合(set),frozenset(冻结集合),类类型,None其他文件类工具:pipes...
分类:
编程语言 时间:
2015-04-29 23:26:55
阅读次数:
350
题目描述
Description:
Count the number of prime numbers less than a non-negative number, n
题目分析
本题求小于n(n为大于零的数)的质数个数。
方法一
int countPrimes1(int n)
{
int count=0;
bool flag=1;
for (int i=2;...
分类:
其他好文 时间:
2015-04-29 21:56:02
阅读次数:
157
题目大意:给出一个字符串,要求你在这个字符串里面加入符号,使得结果为2000解题思路:直接暴力#include
#include
#include
#define maxn 30
using namespace std;
char str[maxn];
bool flag;
int num[maxn], sign[maxn], len;
char...
分类:
其他好文 时间:
2015-04-29 21:48:14
阅读次数:
124
一、数据类型基本数据类型有:整型、浮点型、布尔型、字符型整型(存整数类):intshortlongbyte浮点型(存小数):doublefloatdecimal布尔型(True或False):bool字符型(只存一个字符):char二、变量和常量变量的定义:数据类型变量名[=值]//其中[]内的值可...
分类:
其他好文 时间:
2015-04-29 21:16:37
阅读次数:
104