【2020杭电多校】 The Oculus【签到】

题意:
T组输入,给三个行数,每一行第一个数x(代表之后有长度为x的01串),0代表当前不存在第在第i位的菲薄那切数,1代表存在,问第一行累加的菲薄那切和*第二行的菲薄那切和与第三行修改哪一位后得到的菲薄那切和值相等。

思路:
(A*B)=C+f[k]
这不就是判断两个值是否相同???直接取模判断即可,当然也不需要取模,爆2^64次方就相当于对 2^64 取模,直接写就行

参考代码:

#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <ctime>
#include <cstring>
#include <cstdlib>
#include <math.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll N = 2e6 + 5;
const ll maxn = 1e5 + 5;
ull dp[N];
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    dp[1] = 1ull, dp[2] = 2ull;
    for (ull i = 3; i <N; i++)
        dp[i] = dp[i - 1] + dp[i - 2];
    ull t;
    cin >> t;
    while (t--)
    {
        ull a, b, c, res = 0, ans = 0, cra = 0, x;
        cin >> a;
        for (ull i = 1; i <= a; i++)
        {
            cin >> x;
            if (x == 1)
                res += dp[i];
        }
        cin >> b;
        for (ull i = 1; i <= b; i++)
        {
            cin >> x;
            if (x == 1)
                ans += dp[i];
        }
        cin >> c;
        for (ull i = 1; i <= c; i++)
        {
            cin >> x;
            if (x == 1)
                cra += dp[i];
        }
        ans *= res;
        ull j = 1;
        while (cra != ans-dp[j])
            j++;
        cout << j << endl;
    }
}
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值