/ tabris /

记录详情

Wrong Answer


  
# 状态 耗时 内存占用
#1 Wrong Answer 5ms 1.805 MiB
#2 Wrong Answer 7ms 1.812 MiB
#3 Wrong Answer 4ms 1.809 MiB
#4 Wrong Answer 5ms 1.816 MiB
#5 Wrong Answer 3ms 1.809 MiB
#6 Wrong Answer 56ms 1.812 MiB
#7 Wrong Answer 79ms 1.934 MiB
#8 Wrong Answer 64ms 1.812 MiB
#9 Wrong Answer 55ms 1.805 MiB

代码

#include<stdio.h>
#include<string.h>
#include<iostream>
using namespace std;
#define ll long long int
char a[1500000];
int main()
{
    int t;
    int kase=0;
    scanf("%d",&t);
    while(t--)
    {
        ll k;scanf("%lld",&k);
        memset(a,'0',sizeof(a));
        scanf("%s",a+100);
        ll output=0;
        ll now=0;
        int n=strlen(a);
        for(ll i=0;i<n;i++)
        {
            if(i<k)
            {
                if(a[i]=='1')
                now+=(1<<((k-1-i)));
            }
            else
            {
                now-=(1<<(k-1))*(a[i-k]-'0');
                now*=2;
                now+=(1)*(a[i]-'0');
            }
            output=max(output,now);
        }
        printf("Case #%d: ",++kase);
        printf("%lld\n",output);
    }
}

信息

递交者
类型
递交
题目
幸运大奖
语言
C++
递交时间
2017-09-18 20:34:21
评测时间
2017-09-18 20:34:21
评测机
分数
0
总耗时
282ms
峰值内存
1.934 MiB