ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#212707 | #3827. A | kuanganyin | 50 | 423ms | 1192kb | C++ | 709b | 2024-10-20 09:51:06 | 2024-10-20 12:38:43 |
answer
#include<bits/stdc++.h>
using namespace std;
int n,m;
bool f(int x,int y){
int a[1000]={},b[1000]={},p1=x,p2=y,i1=0,i2=0;
while(p1){
a[i1]=p1%2;
p1/=2;
i1++;
}
while(p2){
b[i2]=p2%2;
p2/=2;
i2++;
}
for(int i=0;i<=max(i1,i2);i++){
if(a[i]+b[i]>1){
return false;
}
a[i]=0,b[i]=0;
}
p1=x,p2=y,i1=0,i2=0;
while(p1){
a[i1]=p1%3;
p1/=3;
i1++;
}
while(p2){
b[i2]=p2%3;
p2/=3;
i2++;
}
for(int i=0;i<=max(i1,i2);i++){
if(a[i]+b[i]>2){
return false;
}
}
return true;
}
int main(){
scanf("%d",&n);
for(int i=1;i<=n;i++){
for(int j=1;j<=n;j++){
if(f(i,j)){
m++;
}
}
}
printf("%d",m);
return 0;
}
详细
小提示:点击横条可展开更详细的信息
Subtask #1:
score: 10
Accepted
Test #1:
score: 10
Accepted
time: 0ms
memory: 1192kb
input:
2
output:
0
result:
ok 1 number(s): "0"
Test #2:
score: 0
Accepted
time: 0ms
memory: 1188kb
input:
8
output:
6
result:
ok 1 number(s): "6"
Subtask #2:
score: 20
Accepted
Test #3:
score: 20
Accepted
time: 0ms
memory: 1188kb
input:
92
output:
348
result:
ok 1 number(s): "348"
Test #4:
score: 0
Accepted
time: 2ms
memory: 1188kb
input:
85
output:
316
result:
ok 1 number(s): "316"
Subtask #3:
score: 20
Accepted
Test #5:
score: 20
Accepted
time: 200ms
memory: 1192kb
input:
939
output:
7730
result:
ok 1 number(s): "7730"
Test #6:
score: 0
Accepted
time: 221ms
memory: 1188kb
input:
994
output:
7994
result:
ok 1 number(s): "7994"
Subtask #4:
score: 0
Time Limit Exceeded
Test #7:
score: 0
Time Limit Exceeded
input:
4375