BZOJ3713: [PA2014]Iloczyn
3713: [PA2014]Iloczyn
Time Limit: 1 Sec Memory Limit: 128 MB
Submit: 206 Solved: 112
[Submit][Status]
Description
斐波那契数列的定义为:k=0或1时,F[k]=k;k>1时,F[k]=F[k-1]+F[k-2]。数列的开头几项为0,1,1,2,3,5,8,13,21,34,55,…你的任务是判断给定的数字能否被表示成两个斐波那契数的乘积。
Input
第一行包含一个整数t(1<=t<=10),表示询问数量。接下来t行,每行一个整数n_i(0<=n_i<=10^9)。
Output
输出共t行,第i行为TAK(是)或NIE(否),表示n_i能否被表示成两个斐波那契数的乘积。
Sample Input
5
4
12
11
10
Sample Output
TAK
NIE
NIE
TAK
HINT
Source
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<string>
#define inf 1000000000
#define maxn 500+100
#define maxm 500+100
#define eps 1e-10
#define ll long long
#define pa pair<int,int>
#define for0(i,n) for(int i=0;i<=(n);i++)
#define for1(i,n) for(int i=1;i<=(n);i++)
#define for2(i,x,y) for(int i=(x);i<=(y);i++)
#define for3(i,x,y) for(int i=(x);i>=(y);i--)
#define mod 1000000007
using namespace std;
inline ll read()
{
ll x=,f=;char ch=getchar();
while(ch<''||ch>''){if(ch=='-')f=-;ch=getchar();}
while(ch>=''&&ch<=''){x=*x+ch-'';ch=getchar();}
return x*f;
}
ll n,m,f[];
int main()
{
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
f[]=;f[]=;
for(n=;n<=;n++)f[n]=f[n-]+f[n-];
m=read();
while(m--)
{
ll x=read(),flag=;
for0(i,n)
for0(j,n)
if(f[i]*f[j]==x){flag=;break;}
if(flag)printf("TAK\n");else printf("NIE\n");
}
return ;
}
BZOJ3713: [PA2014]Iloczyn的更多相关文章
- bzoj3713: [PA2014]Iloczyn(乱搞)
3713: [PA2014]Iloczyn 题目:传送门 题解: 随手一发水题x2 直接离线啊,斐波那契到了第五十个就炒鸡大了 代码: #include<cstdio> #include& ...
- bzoj3713 [PA2014]Iloczyn|暴力(模拟)
斐波那契数列的定义为:k=0或1时,F[k]=k:k>1时,F[k]=F[k-1]+F[k-2].数列的开头几项为0,1,1,2,3,5,8,13,21,34,55,-你的任务是判断给定的数字能 ...
- 【暴力】bzoj3713 [PA2014]Iloczyn
没什么好说的. #include<cstdio> using namespace std; typedef long long ll; ]; int main() { scanf(]=; ...
- BZOJ 3713: [PA2014]Iloczyn( 枚举 )
斐波那契数列<10^9的数很少很少...所以直接暴力枚举就行了... ------------------------------------------------------------- ...
- 3713: [PA2014]Iloczyn
3713: [PA2014]Iloczyn Time Limit: 1 Sec Memory Limit: 128 MBSubmit: 327 Solved: 181[Submit][Status ...
- [PA2014]Iloczyn
[PA2014]Iloczyn 题目大意: 询问\(n(n\le10^9)\)是否是两个斐波那契数之积. 思路: \({\rm fib}(45)<10^9,{\rm fib}(46)>10 ...
- BZOJ 3713: [PA2014]Iloczyn
Description 斐波那契数列的定义为:k=0或1时,F[k]=k:k>1时,F[k]=F[k-1]+F[k-2].数列的开头几项为0,1,1,2,3,5,8,13,21,34,55,-你 ...
- bzoj AC倒序
Search GO 说明:输入题号直接进入相应题目,如需搜索含数字的题目,请在关键词前加单引号 Problem ID Title Source AC Submit Y 1000 A+B Problem ...
- BZOJ 3721: PA2014 Final Bazarek
3721: PA2014 Final Bazarek Time Limit: 20 Sec Memory Limit: 128 MBSubmit: 645 Solved: 261[Submit][ ...
随机推荐
- linux0.12 链接过程
终于编译OK了..可链接就是一大堆错误 问题1: boot/head.o: In function `startup_32': (.text+0x10): undefined reference to ...
- JavaScript 类私有方法的实现
一:将私有方法移出模块,因为模块内部的所有方法都是对外可见的. class Widget { foo (baz) { bar.call(this, baz); } // ... } function ...
- [Node.js] node-persist: localStorage on the server
// Save data var storage = require('node-persist'); storage.init(); var people= require('./people.js ...
- java中不常见的keyword:strictfp,transient
1.strictfp, 即 strict float point (精确浮点). strictfp keyword可应用于类.接口或方法.使用 strictfp keyword声明一个方法时,该方法中 ...
- POJ 2502 Subway(迪杰斯特拉)
Subway Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 6692 Accepted: 2177 Descriptio ...
- Duanxx的技术问题:word界面显示模糊
今天打开word时,出现了word打开失败的现象,并且word的界面显示特别的模糊,找了好半天,才解决,问题见下图: 解决方式: 在word的文件->选项,这里面找到显示,然后勾选:禁用硬件图形 ...
- mybatis一对多,多对一
假设两张表 person对order为一对多 实体类 person package com.kerwin.mybatis.pojo; import java.util.List; public cla ...
- CVE-2016-5343分析
最近在学习android内核漏洞,写篇博做个记录,也算是所学即用. https://www.codeaurora.org/multiple-memory-corruption-issues-write ...
- css优先级计算
主要的css选择器有id,class,tag,[],:,::等,而通常需要对其优先级进行判断的有id,class,tag,另外内联样式和!important也和css的优先级有关系. 如果将这五种不同 ...
- getParameter百科
获取数据库中的参数数据 getParameter(). request.getParameter("username");其中的这个username 是接受前台的参数 比如in ...