ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#212711 | #3827. A | zhangtianhao123456 | 100 | 1101ms | 1200kb | C++ | 775b | 2024-10-20 09:52:07 | 2024-10-20 12:38:56 |
answer
#include<bits/stdc++.h>
using namespace std;
bool nm(int n,int x)
{
int mjj=n+x;
while (n>0||x>0||mjj>0)
{
int a1=n&1;
int a2=x&1;
int a3=mjj&1;
if((a1&a2)&&a3==0) return false;
n>>=1;
x>>=1;
mjj>>=1;
}
return true;
}
bool app(int n,int x)
{
int mjj=n+x;
int ggb=0;
while (n>0||x>0||mjj>0)
{
int a1=n%3;
int a2=x%3;
int a3=a1+a2+ggb;
if(a3>=3)return false;
ggb=a3/3;
n/=3;
x/=3;
mjj/=3;
}
return true;
}
int cnm(int n)
{
int xx=0;
for(int i=1;i<=n;i++)
{
for(int k=1;k<=n;k++)
{
if(nm(i,k)&&app(i,k))
{
xx++;
}
}
}
return xx;
}
int main()
{
int n;
std::cin>>n;
std::cout<<cnm(n)<<std::endl;
return 0;
}
详细
小提示:点击横条可展开更详细的信息
Subtask #1:
score: 10
Accepted
Test #1:
score: 10
Accepted
time: 0ms
memory: 1200kb
input:
2
output:
0
result:
ok 1 number(s): "0"
Test #2:
score: 0
Accepted
time: 0ms
memory: 1200kb
input:
8
output:
6
result:
ok 1 number(s): "6"
Subtask #2:
score: 20
Accepted
Test #3:
score: 20
Accepted
time: 0ms
memory: 1200kb
input:
92
output:
348
result:
ok 1 number(s): "348"
Test #4:
score: 0
Accepted
time: 0ms
memory: 1200kb
input:
85
output:
316
result:
ok 1 number(s): "316"
Subtask #3:
score: 20
Accepted
Test #5:
score: 20
Accepted
time: 6ms
memory: 1196kb
input:
939
output:
7730
result:
ok 1 number(s): "7730"
Test #6:
score: 0
Accepted
time: 11ms
memory: 1196kb
input:
994
output:
7994
result:
ok 1 number(s): "7994"
Subtask #4:
score: 50
Accepted
Test #7:
score: 50
Accepted
time: 186ms
memory: 1196kb
input:
4375
output:
58626
result:
ok 1 number(s): "58626"
Test #8:
score: 0
Accepted
time: 207ms
memory: 1196kb
input:
4594
output:
66410
result:
ok 1 number(s): "66410"
Test #9:
score: 0
Accepted
time: 241ms
memory: 1196kb
input:
4989
output:
74836
result:
ok 1 number(s): "74836"
Test #10:
score: 0
Accepted
time: 229ms
memory: 1196kb
input:
4877
output:
73756
result:
ok 1 number(s): "73756"
Test #11:
score: 0
Accepted
time: 221ms
memory: 1196kb
input:
4790
output:
72308
result:
ok 1 number(s): "72308"
Extra Test:
score: 0
Extra Test Passed