UOJ Logo

NOI.AC

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#212663#3827. A1581856721001ms1200kbC++1008b2024-10-20 09:06:292024-10-20 12:35:43

answer

#include<bits/stdc++.h>
using namespace std;
bool vis[25],ans[25];
void O_o()
{
  int n,cnt=0,a[]={1,10,11,100,101,110,111,1000,1001,1010,1011,1100,1101,1110,1111,10000,10001,10010,10011,10100},b[]={1,2,10,11,12,20,21,22,100,101,102,110,111,112,120,121,122,200,201,202};
  cin>>n;
  for(int i=1;i<=n;i++)
  {
    for(int j=1;j<=n;j++)
    {
      int k=i+j;
      if(vis[k]) 
      {
        if(ans[k])  cnt++;
        continue;
      }
      bool p=true;
      int a1=a[i]+a[j],b1=b[i]+b[j];
      while(a1>0)
      {
        if(a1%10>1)
        {
          p=false;
          break;
        }
        a1/=10;
      }
      while(b1>0)
      {
        if(b1%10>2)
        {
          p=false;
          break;
        }
        b1/=10;
      }
      vis[k]=true;
      ans[k]=p;
      if(p) cnt++;
    }
  }
  cout<<cnt;
}
int main()
{
  //freopen(".in","r",stdin);
  //freopen(".out","w",stdout);
  int T=1;
  //cin>>T;
  while(T--)  O_o();
  return 0;
}

详细

小提示:点击横条可展开更详细的信息

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 10
Accepted
time: 1ms
memory: 1200kb

input:

2

output:

0

result:

ok 1 number(s): "0"

Test #2:

score: -10
Wrong Answer
time: 0ms
memory: 1196kb

input:

8

output:

18

result:

wrong answer 1st numbers differ - expected: '6', found: '18'

Subtask #2:

score: 0
Wrong Answer

Test #3:

score: 0
Wrong Answer
time: 0ms
memory: 1196kb

input:

92

output:

6035

result:

wrong answer 1st numbers differ - expected: '348', found: '6035'

Subtask #3:

score: 0
Wrong Answer

Test #5:

score: 0
Wrong Answer
time: 0ms
memory: 1200kb

input:

939

output:

880663

result:

wrong answer 1st numbers differ - expected: '7730', found: '880663'

Subtask #4:

score: 0
Runtime Error

Test #7:

score: 0
Runtime Error

input:

4375

output:


result: