CHOICEONE


私信TA

用户名:CHOICEONE

访问量:490

签 名:

等  级
排  名 12770
经  验 906
参赛次数 0
文章发表 3
年  龄 0
在职情况 学生
学  校 烟台大学
专  业

  自我简介:

解题思路:
存在一个最小的整数x,使得pow(2,x)>=n,则每隔pow(2,x)就会循环一次。

注意事项:

参考代码:

#include<iostream>

#include<cstring>

using namespace std;

typedef long long ll;

string s;

string temp;

ll n;

ll t;

int yihuo(char a,char b)

{

if(a==b)

return 0;

return 1;

}

int main()

{

   cin>>n>>t;

   cin>>s;

   ll max_per=1;

   while(max_per<n)

   max_per*=2;

   t%=max_per;

   for(int i=0;i<t;i++)

   {

    temp=s;

    for(int j=1;j<n;j++)

    s[j]=(temp[j-1]-'0')^(temp[j]-'0')+'0';

   }

   cout<<s;

    return 0;


 

0.0分

0 人评分

看不懂代码?想转换其他语言的代码? 或者想问其他问题? 试试问问AI编程助手,随时响应你的问题:

编程语言转换

万能编程问答  

代码解释器

代码纠错

SQL生成与解释

  评论区