QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#123370#5434. Binary Substringssuyue#WA 0ms1864kbC++14577b2023-07-12 14:01:342023-07-12 14:01:35

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-07-12 14:01:35]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:1864kb
  • [2023-07-12 14:01:34]
  • 提交

answer

#include<stdio.h>
#define ll long long
int n;
ll cal(int a,int b,int c){
    return 1ll*a*b+1ll*b*c+1ll*a*c+a+b;
}
int main(){
    scanf("%d",&n);
    int a,b,c;
    ll maxs=0,maxc=0;
    for(int i=1;i<=n;i++){
        c=i;
        a=(n-c)/2;
        b=n-a-c;
        ll p=cal(a,b,c);
        if(p>maxs){
            maxs=p;
            maxc=i;
        }
    }
    c=maxc;
    a=(n-c)/2;
    b=n-a-c;
    for(int i=1;i<=a;i++)putchar('0');
    for(int i=1;i<=b;i++)putchar('1');
    for(int i=1;i<=c;i++)putchar('0');
    puts("");
    return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 1864kb

input:

2

output:

10

result:

ok meet maximum 3

Test #2:

score: 0
Accepted
time: 0ms
memory: 1740kb

input:

5

output:

00110

result:

ok meet maximum 12

Test #3:

score: 0
Accepted
time: 0ms
memory: 1748kb

input:

1

output:

1

result:

ok meet maximum 1

Test #4:

score: 0
Accepted
time: 0ms
memory: 1424kb

input:

3

output:

010

result:

ok meet maximum 5

Test #5:

score: 0
Accepted
time: 0ms
memory: 1744kb

input:

4

output:

0110

result:

ok meet maximum 8

Test #6:

score: 0
Accepted
time: 0ms
memory: 1556kb

input:

6

output:

001110

result:

ok meet maximum 16

Test #7:

score: 0
Accepted
time: 0ms
memory: 1548kb

input:

7

output:

0001110

result:

ok meet maximum 21

Test #8:

score: 0
Accepted
time: 0ms
memory: 1552kb

input:

8

output:

00011100

result:

ok meet maximum 27

Test #9:

score: -100
Wrong Answer
time: 0ms
memory: 1740kb

input:

9

output:

000111100

result:

wrong answer not meet maximum 33 < 34