山东省第八届 ACM 省赛 Parity check (规律、水)

网友投稿 258 2022-08-31

山东省第八届 ACM 省赛 Parity check (规律、水)

Description

Fascinated with the computer games, Gabriel even forgets to study. Now she needs to finish her homework, and there is an easy problem: f(n)=⎧⎩⎨0,n=01,n=1f(n−1)+f(n−2),n≥2 She is required to calculate f(n) mod 2 for each given n. Can you help her?

Input

Multiple test cases. Each test case is an integer n(0≤n≤) in a single line.

Output

For each test case, output the answer of f(n)mod2.

Example Input

2

Example Output

1

题意

给出 ​​f(n)​​​ 的递推式以及 ​​n​​​ 的值,求 ​​f(n)%2​​ 的结果。

思路

模 2 当然是有规律的啦,果断打表看了一下 ​​110​​ ,然后输出。

AC 代码

#include#include#include#include#include#includeusing namespace std;#include#include#define eps (1e-8)const int mod = 1e9+7;typedef long long LL;char str[1100];int get(){ int no=0; int len=strlen(str); for(int i=0; i>str) cout<

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:休克文案:福特EVOS解码潮流爆款制造机!
下一篇:操作系统 -- PV操作
相关文章

 发表评论

暂时没有评论,来抢沙发吧~