ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#212697 | #3827. A | tangyuqin | 0 | 0ms | 1216kb | C++ | 772b | 2024-10-20 09:46:25 | 2024-10-20 12:38:08 |
answer
#include<iostream>
#include<cmath>
using namespace std;
int n,a[2],b[1001],m;
int p(long long x){
int a=0;
while(x!=0){
a++;
x/=10;
}
return a;
}
int j(int x,int y, int z){
if(p(x)==(p(y)>p(z)?p(y):p(z))){
int s=p(x);
for(int i=s-1;i>0;i--){
if(x/pow(10,i)!=y/pow(10,i)+z/pow(10,i))return 0;
}
return 1;
}
return 0;
}
int e(int x,int y){
int a=0,b=0;
while(x!=0){
a=a+(x%y)*pow(10,b);
b++;
x/=y;
}
return a;
}
void d(int s){
if(s==2){
int h=a[0]+a[1];
if(j(e(h,2),e(a[1],2),e(a[0],2))&&j(e(h,2),e(a[1],2),e(a[0],2)))m++;
}
for(int i=1;i<=n;i++){
if(b[i]==0){
b[i]=1;
a[s]=i;
d(s+1);
b[i]=0;
}
}
return;
}
int main(){
cin>>n;
d(0);
cout<<m;
return 0;
}
详细
小提示:点击横条可展开更详细的信息
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 1216kb
input:
2
output:
2
result:
wrong answer 1st numbers differ - expected: '0', found: '2'
Subtask #2:
score: 0
Wrong Answer
Test #3:
score: 0
Wrong Answer
time: 0ms
memory: 1216kb
input:
92
output:
2
result:
wrong answer 1st numbers differ - expected: '348', found: '2'
Subtask #3:
score: 0
Wrong Answer
Test #5:
score: 0
Wrong Answer
time: 0ms
memory: 1212kb
input:
939
output:
2
result:
wrong answer 1st numbers differ - expected: '7730', found: '2'
Subtask #4:
score: 0
Wrong Answer
Test #7:
score: 0
Wrong Answer
time: 0ms
memory: 1216kb
input:
4375
output:
2
result:
wrong answer 1st numbers differ - expected: '58626', found: '2'