HDU 5167(map + 暴力)】的更多相关文章

题意:给出一个数n,问n能否是斐波那契数列中数的乘积 先刷选 斐波那契数列,然后就枚举 #include <cstdio> #include <cstring> #include <queue> #include <map> #include <iostream> using namespace std; typedef long long LL; ; LL num[]; map<LL, bool> m; void init() {…
Numbers Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=5522 Description 给n个数A1,A2....An{A}_{1},{A}_{2}....{A}_{n}A​1​​,A​2​​....A​n​​,从中选3个位置不同的数A,B和C,问是否有一种情况满足A-B=C. Input There are multiple test cases, no mo…
GCD/center> 题目连接: http://acm.hdu.edu.cn/showproblem.php?pid=5726 Description Give you a sequence of N(N≤100,000) integers : a1,...,an(0<ai≤1000,000,000). There are Q(Q≤100,000) queries. For each query l,r you have to calculate gcd(al,,al+1,...,ar) a…
题目链接: hdu: http://acm.hdu.edu.cn/showproblem.php?pid=5167 题意: 给你一个x,判断x能不能由斐波那契数列中的数相乘得到(一个数可以重复使用) 题解: 1.筛法 首先,小于10^9的斐波那契数很少,就42个(不包括0,1),对于给定的x能同时成为它的因子的斐波那契数更少,所以可以暴力考虑所有能整除x的斐波那契数组成的集合的所有子集. 但是,对于每个子集做筛法的时候必须从大的数开始筛(质因数分解可以随便筛是因为一个数的质因数分解具有唯一性,但…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4291 思路:首先保留求出循环节,然后就是矩阵求幂了. #include<iostream> #include<cstdio> #include<cstring> #include<algorithm> using namespace std; typedef __int64 ll; #define MOD2 1000000007 #define MOD1 222…
http://acm.hdu.edu.cn/showproblem.php?pid=1075 What Are You Talking About Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 102400/204800 K (Java/Others)Total Submission(s): 13618    Accepted Submission(s): 4366 Problem Description Ignatius is…
http://acm.hdu.edu.cn/showproblem.php?pid=1247 Hat’s Words Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 7760    Accepted Submission(s): 2814 Problem Description A hat’s word is a word in the…
Bazinga Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=5510 Description Ladies and gentlemen, please sit up straight. Don't tilt your head. I'm serious.For n given strings S1,S2,⋯,Sn, labelled from 1 to n, you…
USACO ORZ Time Limit: 5000/1500 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 2291    Accepted Submission(s): 822 Problem Description Like everyone, cows enjoy variety. Their current fancy is new shapes for pastur…
题目链接:hdu 5077 NAND 题目大意:Xiaoqiang要写一个编码程序,然后依据x1,x2,x3的值构造出8个字符.如今给定要求生成的8个字符.问 说Xiaoqiang最少要写多少行代码.代码内容仅仅能为NAND操作和return操作,操作的变量能够是常数. 解题思路:输入总共就256中情况,所以暴力剪枝打表,打表的代码手贱给删了...所以就将一下思路.开一个s数组 表示变量,然后相应每一层每次两个变量进行NAND操作. 大致三个剪枝,dfs时候,变量出现同样就跳过.8个字符能够直接…