站外题求助
  • 板块灌水区
  • 楼主Eous
  • 当前回复10
  • 已保存回复10
  • 发布时间2024/10/18 15:21
  • 上次更新2024/10/18 18:45:19
查看原帖
站外题求助
549131
Eous楼主2024/10/18 15:21

题面在此

#include<bits/stdc++.h>
#define int long long
using namespace std;
int t,cnt;
int x,len1,len2,len;
string s1,s2;
string str1,str2;
signed main()
{
    freopen("data","r",stdin);
    freopen("out","w",stdout);
    cin >> len1 >> len2 >> t;
    cin >> s1 >> s2;
    len = len1 + len2;
    str1 = s1 + s2;
    str2 = s2 + s1;
    while (t--)
    {
        cin >> x;
        cnt = 0;
        for (int i = 54; i >= 0; i--)
        {
            if (len * (1ll << i) < x)
            {
                x -= len * (1ll << i);
                cnt ++;
            }
        }
        if (cnt & 1)
            cout << str2[x - 1] << endl;
        else
            cout << str1[x - 1] << endl;
    }
    return 0;
}

在OJ上RE了,但是甩到NOI Linux用gdb调试什么事都没有,返回值是0

2024/10/18 15:21
加载中...