c语言sscanf函数的用法是什么
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
发表评论
暂时没有评论,来抢沙发吧~