2 条题解

  • 1
    @ 2023-9-17 22:30:22
    #include <bits/stdc++.h>
    using namespace std;
    int sum[11] = {6, 2, 5, 5, 4, 5, 6, 3, 7, 6};
    int n,t = 0;
    int work(int x) 
    {
        int ans = 0, k;
        if(x == 0) return sum[0];
        else 
        {
            while(x != 0) 
            {
                k = x % 10;
                x /= 10;
                ans += sum[k];
            }
            return ans;
        }
    }
    int main() 
    {
        cin >> n;
        for(int i = 0; i <= 1000; i++)
            for(int j = 0; j <= 1000; j++) 
            {
                if(work(i) + work(j) + work(i + j) + 4 == n)
                    t++;
            }
        cout << t << '\n';
        return 0;
    }
    
    • 0
      @ 2023-12-4 22:54:46
      #include<bits/stdc++.h>
      using namespace std;
      int a[2001]={6},b,c[10]={6,2,5,5,4,5,6,3,7,6},s=0; 
      int main(){
              cin>>b;
              for(int i=1;i<=2000;i++){
                      int j=i;
                      while(j>=1){
                          a[i]=a[i]+c[j%10];
                          j=j/10;
                      }
              }
              for(int i=0;i<=1000;i++){
                      for(int j=0;j<=1000;j++)
                      if(a[i]+a[j]+a[i+j]+4==b)s++;
              }
              cout<<s;
              return 0;
      }
      
      • 1

      信息

      ID
      702
      时间
      1000ms
      内存
      50MiB
      难度
      8
      标签
      递交数
      14
      已通过
      8
      上传者