ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#212703 | #3827. A | wyc6326 | 30 | 109ms | 1320kb | C++11 | 1.0kb | 2024-10-20 09:49:44 | 2024-10-20 12:38:25 |
answer
#include<bits/stdc++.h>
using namespace std;
template<class A,class B>
B trans(const A &a)
{
stringstream st;
st<<a;
B b;
st>>b;
return b;
}
int trans1(int n)
{
int ans=0,cur=1;
while(n)
{
//305
ans=ans+n%2*cur;
n/=2;
cur*=10;
}
string tmp=trans<int,string>(ans);
return trans<string,int>(tmp);
}
int trans2(int n)
{
int ans=0,cur=1;
while(n)
{
//3
ans=ans+n%3*cur;
n/=3;
cur*=10;
}
string tmp=trans<int,string>(ans);
return trans<string,int>(tmp);
}
int main()
{
//freopen("A.in","r",stdin);
//freopen("A.out","w",stdout);
int n;scanf("%d",&n);
bool flag=0;
int cnt=0;
for(int i=1;i<=n;i++)
{
for(int j=1;j<=n;j++)
{
flag=1;
//(i,j)
int i2=trans1(i);
int i3=trans2(i);
int j2=trans1(j);
int j3=trans2(j);
for(char c:trans<int,string>(i2+j2)) //10+100
{
if(c-'0'>=2) flag=0;
}
for(char c:trans<int,string>(i3+j3)) //2+11
{
if(c-'0'>=3&&flag) flag=0;
}
if(flag) cnt++;
}
}
printf("%d",cnt);
return 0;
}
Details
小提示:点击横条可展开更详细的信息
Subtask #1:
score: 10
Accepted
Test #1:
score: 10
Accepted
time: 0ms
memory: 1316kb
input:
2
output:
0
result:
ok 1 number(s): "0"
Test #2:
score: 0
Accepted
time: 0ms
memory: 1316kb
input:
8
output:
6
result:
ok 1 number(s): "6"
Subtask #2:
score: 20
Accepted
Test #3:
score: 20
Accepted
time: 58ms
memory: 1320kb
input:
92
output:
348
result:
ok 1 number(s): "348"
Test #4:
score: 0
Accepted
time: 51ms
memory: 1320kb
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