QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#123370 | #5434. Binary Substrings | suyue# | WA | 0ms | 1864kb | C++14 | 577b | 2023-07-12 14:01:34 | 2023-07-12 14:01:35 |
Judging History
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