QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#602154 | #7034. Honeycomb | ucup-team5071# | WA | 0ms | 3712kb | C++20 | 1.4kb | 2024-09-30 20:20:44 | 2024-09-30 20:20:45 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define int long long
void Solve(){
int h1,h2,a1,a2;
cin>>h1>>h2>>a1>>a2;
int s=0,m1=0,p1=0,n1=0,m2=0,p2=0,n2=0,min_p2=0;
while(1){
++m1;
s+=m1;
if(s>=h1){
p1=s-h1;
break;
}
}
n1=m1;
s=p1;
while(1){
++n1;
s+=n1;
if(s>=h2){
if(s-h2>=p1)p1=0;
break;
}
}
s=0;
while(1){
++m2;
s+=m2;
if(s>=h2){
p2=s-h2;
break;
}
}
n2=m2;
s=p2;
while(1){
++n2;
s+=n2;
if(s>=h1){
min_p2=p2-(s-h1);
break;
}
}
if(a1*m1+a2*n1<=a2*m2+a1*n2){
cout<<a1*m1+a2*n1<<" ";
for(int i=1;i<=m1;i++){
if(i==p1)cout<<'B';
else cout<<'A';
}
for(int i=m1+1;i<=n1;i++)
cout<<'B';
}
else {
cout<<a2*m2+a1*n2<<" ";
for(int i=1;i<=m2;i++){
if(i==min_p2)cout<<'A';
else cout<<'B';
}
for(int i=m2+1;i<=n2;i++)
cout<<'A';
}
cout<<endl;
}
signed main(){
ios::sync_with_stdio(false),cin.tie(0);
int T;
cin>>T;
while(T--)Solve();
return 0;
}
详细
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3712kb
input:
1 3 4 +---+ +---+ / \ / \ + +---+ +---+ \ \ / \ + + S +---+ T + / \ / / + +---+ + + \ \ / \ +---+ +---+ + / / + +---+ + + \ ...
output:
0 AABB
result:
wrong answer 1st lines differ - expected: '7', found: '0 AABB'