ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#212705 | #3827. A | Caohanxuan_111213 | 30 | 14ms | 1204kb | C++ | 1.3kb | 2024-10-20 09:50:08 | 2024-10-20 12:38:35 |
answer
#include<bits/stdc++.h>
using namespace std;
bool er(int a,int d){
int b[1005]={0};
int u=1;
for(int i=1;i<=a;i++){
b[1]+=1;
for(int j=1;j<=u;j++){
if(b[j]==2){
if(j==u){
u++;
}
b[j+1]+=1;
b[j]=0;
}
}
}
int c[1005]={0};
int h=1;
for(int i=1;i<=d;i++){
c[1]+=1;
for(int j=1;j<=h;j++){
if(c[j]==2){
if(j==h){
h++;
}
c[j+1]+=1;
c[j]=0;
}
}
}
bool g=1;
for(int i=1;i<=min(u,h);i++){
if(b[i]+c[i]>=2){
g=0;
break;
}
}
if(g==0){
return false;
}
else{
return true;
}
}
bool san(int a,int d){
int b[1005]={0};
int u=1;
for(int i=1;i<=a;i++){
b[1]+=1;
for(int j=1;j<=u;j++){
if(b[j]==3){
if(j==u){
u++;
}
b[j+1]+=1;
b[j]=0;
}
}
}
int c[1005]={0};
int h=1;
for(int i=1;i<=d;i++){
c[1]+=1;
for(int j=1;j<=h;j++){
if(c[j]==3){
if(j==h){
h++;
}
c[j+1]+=1;
c[j]=0;
}
}
}
bool g=1;
for(int i=1;i<=min(u,h);i++){
if(b[i]+c[i]>=3){
g=0;
break;
}
}
if(g==0){
return false;
}
else{
return true;
}
}
int main(){
int a,ans=0;
cin>>a;
for(int i=1;i<=a;i++){
for(int j=1;j<=a;j++){
if(er(i,j)&&san(i,j)){
ans++;
}
}
}
cout<<ans;
return 0;
}
详细
小提示:点击横条可展开更详细的信息
Subtask #1:
score: 10
Accepted
Test #1:
score: 10
Accepted
time: 0ms
memory: 1204kb
input:
2
output:
0
result:
ok 1 number(s): "0"
Test #2:
score: 0
Accepted
time: 0ms
memory: 1204kb
input:
8
output:
6
result:
ok 1 number(s): "6"
Subtask #2:
score: 20
Accepted
Test #3:
score: 20
Accepted
time: 8ms
memory: 1204kb
input:
92
output:
348
result:
ok 1 number(s): "348"
Test #4:
score: 0
Accepted
time: 6ms
memory: 1200kb
input:
85
output:
316
result:
ok 1 number(s): "316"
Subtask #3:
score: 0
Time Limit Exceeded
Test #5:
score: 0
Time Limit Exceeded
input:
939
output:
result:
Subtask #4:
score: 0
Time Limit Exceeded
Test #7:
score: 0
Time Limit Exceeded
input:
4375