C Sleepy Kaguya
链接:https://ac.nowcoder.com/acm/contest/338/C
来源:牛客网
题目描述
This sequence can be described by following equations:
1.F[1]=F[2]=1
Now, Kaguya is required to calculate F[k+1]*F[k+1]-F[k]*F[k+2] for each integer k that does not exceed 10^18.
输入描述:
Input
Only one integer k.
输出描述:
Output
Only one integer as the result which is equal to F[k+1]*F[k+1]-F[k]*F[k+2].
备注:
0 < k ≤ 1^18
If necessary, please use %I64d instead of %lld when you use "scanf", or just use "cin" to get the cases. The online judge of HNU has the above feature, thank you for your cooperation. 找规律 -1 1
#include<stdio.h>
#include<iostream>
using namespace std;
int main()
{
unsigned long long int n;
cin >> n;
if(n&1)
cout<<"-1"<<"\n";
else
cout<<""<<"\n";
}
C Sleepy Kaguya的更多相关文章
- 树状数组 || 线段树 || Luogu P5200 [USACO19JAN]Sleepy Cow Sorting
题面:P5200 [USACO19JAN]Sleepy Cow Sorting 题解: 最小操作次数(记为k)即为将序列倒着找第一个P[i]>P[i+1]的下标,然后将序列分成三部分:前缀部分( ...
- Codeforces 937D - Sleepy Game
937D - Sleepy Game 思路: dfs. vis[u][0]==1表示u这个点能从s点偶数路径到达 vis[u][1]==1表示u这个点能从s点奇数路径到达 这个样就能保证dfs时每个点 ...
- Codeforces 937 D. Sleepy Game(DFS 判断环)
题目链接: Sleepy Game 题意: Petya and Vasya 在玩移动旗子的游戏, 谁不能移动就输了. Vasya在订移动计划的时候睡着了, 然后Petya 就想趁着Vasya睡着的时候 ...
- Codeforces 937.D Sleepy Game
D. Sleepy Game time limit per test 2 seconds memory limit per test 256 megabytes input standard inpu ...
- LG5200 「USACO2019JAN」Sleepy Cow Sorting 树状数组
\(\mathrm{Sleepy Cow Sorting}\) 问题描述 LG5200 题解 树状数组. 设\(c[i]\)代表\([1,i]\)中归位数. 显然最终的目的是将整个序列排序为一个上升序 ...
- P5200 [USACO19JAN]Sleepy Cow Sorting
P5200 [USACO19JAN]Sleepy Cow Sorting 题目描述 Farmer John正在尝试将他的N头奶牛(1≤N≤10^5),方便起见编号为1…N,在她们前往牧草地吃早餐之前排 ...
- Sleepy与DbgHlp库学习
参考:http://msdn.microsoft.com/en-us/library/windows/desktop/ms679291(v=vs.85).aspx http://msdn.micros ...
- UVa 10427 - Naughty Sleepy Boys
题目大意:从1开始往后写数字,构成一个如下的字符串 123456789101112... .求第n位的数字是多少. 找规律,按数字的位数可以构建一个类似杨辉三角的东西,求出第n位是哪个数的第几位即可. ...
- Codeforces Round #467 (Div. 1) B. Sleepy Game
我一开始把题目看错了 我以为是博弈.. 这题就是一个简单的判环+dfs(不简单,挺烦的一题) #include <algorithm> #include <cstdio> #i ...
随机推荐
- 2018-12-25-win10-uwp-显示SVG
title author date CreateTime categories win10 uwp 显示SVG lindexi 2018-12-25 10:37:5 +0800 2018-2-13 1 ...
- 定位公众号页面,跳转之后 vuejs 失效问题
是第一个页面的. data () { }, 写成了这样,没写返回 {} 5555~. 网页中死活可以,微信中死活不行. data () { return {} },
- 【leetcode】403. Frog Jump
题目如下: 解题思路:我的做法是建立一个字典dic,key为stone,value是一个set,里面存的是从前面的所有stone跳跃到当前stone的unit集合.例如stones=[0,1,2,3] ...
- common pom
<dependencies> <dependency> <groupId>com.github.pagehelper</groupId> <art ...
- OC 类的load方法
+(void)load 方法 不需要主动调用,类加载时会走这个方法
- 项目部署到tomcat上
1:先讲解一下tomcat的各个目录的作用 2:将项目打包成war的格式,然后放到webapps chengtai 是启动项目的时候自动解压的,不需要我们手动解压. 3:启动tomcat 进入到b ...
- 攻防世界 | level2
# ! /usr/bin/env python # -*- coding:utf-8 -*- from pwn import * context.log_level = 'debug' elf = E ...
- HDU 5179 beautiful number (数位dp / 暴力打表 / dfs)
beautiful number Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) ...
- 如何查看MySQL数据库的版本
如何查看MySQL数据库的版本 一.总结 一句话总结: SQL语句:select version(); 命令行:mysql -V 或 mysql --version 二.三种方法查看MySQL数据库的 ...
- Advanced search keywords
Advanced search options Find what you're looking for in less time. Use the following symbols to quic ...