求助
  • 板块灌水区
  • 楼主高启凯
  • 当前回复3
  • 已保存回复3
  • 发布时间2022/11/17 22:05
  • 上次更新2023/10/27 02:35:38
查看原帖
求助
736701
高启凯楼主2022/11/17 22:05
/tmp/compiler_t5l9_qxd/src:4:1: 错误:‘nb’不是一个类型名
    4 | nb[0]=6;
      | ^~
/tmp/compiler_t5l9_qxd/src:5:1: 错误:‘nb’不是一个类型名
    5 | nb[1]=2;
      | ^~
/tmp/compiler_t5l9_qxd/src:6:1: 错误:‘nb’不是一个类型名
    6 | nb[2]=5;
      | ^~
/tmp/compiler_t5l9_qxd/src:7:1: 错误:‘nb’不是一个类型名
    7 | nb[3]=5;
      | ^~
/tmp/compiler_t5l9_qxd/src:8:1: 错误:‘nb’不是一个类型名
    8 | nb[4]=4;
      | ^~
/tmp/compiler_t5l9_qxd/src:9:1: 错误:‘nb’不是一个类型名
    9 | nb[5]=5;
      | ^~
/tmp/compiler_t5l9_qxd/src:10:1: 错误:‘nb’不是一个类型名
   10 | nb[6]=6;
      | ^~
/tmp/compiler_t5l9_qxd/src:11:1: 错误:‘nb’不是一个类型名
   11 | nb[7]=3;
      | ^~
/tmp/compiler_t5l9_qxd/src:12:1: 错误:‘nb’不是一个类型名
   12 | nb[8]=7;
      | ^~
/tmp/compiler_t5l9_qxd/src:13:1: 错误:‘nb’不是一个类型名
   13 | nb[9]=6;
      | ^~
#include<bits/stdc++.h>
using namespace std;
int nb[10000];
nb[0]=6;
nb[1]=2;
nb[2]=5;
nb[3]=5;
nb[4]=4;
nb[5]=5;
nb[6]=6;
nb[7]=3;
nb[8]=7;
nb[9]=6;
int num(int n){
    int t=0;
    while(n){
        t+=nb[n%10];
        n/=10;
    }
    return t;
}
void init(){
    for(int i=10;i<2000;i++){
        nb[i]=num(i);
    }
}
int main(){
    int n,t(0);
    cin>>n;
    for(int i=1;i<n;i++){
        for(int j=0;j<=n-i;j++){
            int value=i+j;
            if(nb[value]+nb[i]+nb[j]+4==n)
                t++;
        }
    }
    cout<<t;
}

???

2022/11/17 22:05
加载中...