/ tabris /

记录详情

Wrong Answer


  
# 状态 耗时 内存占用
#1 Wrong Answer 18ms 11.309 MiB
#2 Wrong Answer 18ms 11.316 MiB
#3 Wrong Answer 10ms 11.43 MiB
#4 Wrong Answer 11ms 11.309 MiB
#5 Wrong Answer 10ms 11.309 MiB
#6 Wrong Answer 63ms 11.312 MiB
#7 Wrong Answer 64ms 11.312 MiB
#8 Wrong Answer 63ms 11.309 MiB
#9 Wrong Answer 66ms 11.43 MiB

代码

#include<stdio.h>
#include<string.h>
#include<iostream>
using namespace std;
#define ll long long int
char a[11500000];
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);
        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+=(1ll<<((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:45:16
评测时间
2017-09-18 20:45:16
评测机
分数
0
总耗时
327ms
峰值内存
11.43 MiB