QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#348219#8337. Counter Reset Problemucup-team346#Compile Error//C++141.7kb2024-03-09 17:28:352024-03-09 17:28:36

Judging History

你现在查看的是最新测评结果

  • [2024-03-09 17:28:36]
  • 评测
  • [2024-03-09 17:28:35]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

const int P = 1000000009;

void Add(int &a,int b){
    a += b;
    if(a >= P) a -= P;
}

int n;
int f[5005][1050][2],sum[5005][1050][2];
const int M = (1 << 10) - 1;
const int M2 = (1 << 10) - 2;

int calc(string s){
    memset(f,0,sizeof(f));
    memset(sum,0,sizeof(sum));
    f[0][0][1] = 1;
    for(int i = 1;i <= n;i ++){
        for(int S = 0;S < (1 << 10);S ++){
            for(int id = 0;id < 2;id ++){
                for(int cur = 0;cur <= (id ? s[i] - '0' : 9);cur ++){
                    int val = (i == 1 ? 10 - cur : 10);
                    if(((1 << (cur + 1)) - 1) & S) val = 0;
                    if(cur == 0) val = 0;
                    Add(f[i][(S | (1 << cur)) & (M << cur) & M2][id && cur == s[i] - '0'],f[i - 1][S][id]);
                    Add(sum[i][(S | (1 << cur)) & (M << cur) & M2][id && cur == s[i] - '0'],(1ll * f[i - 1][S][id] * val % P + sum[i - 1][S][id]) % P);
                }
            }
        }
    }
    int ret = 0;
    for(int S = 0;S < (1 << 10);S ++){
        for(int id = 0;id < 2;id ++){
            Add(ret,sum[n][S][id]);
        }
    }
    return ret;
}

void solve(){
    cin >> n;
    string s,t;
    cin >> s >> t;
    s = ' ' + s; t = ' ' + t;
    int fl = 1;
    for(int i = 1;i <= n;i ++){
        if(s[i] > '0') fl = 0;
    }
    if(fl) cout << calc(t) << '\n';
    else{
        s[n] --;
        for(int i = n;i >= 1;i --){
            if(s[i] < '0'){
                s[i] += 10;
                s[i - 1] --;
            }
        }
        cout << calc(t) - calc(s) << '\n';
    }
}

int main(){
    ios::sync_with_stdio(false);
    solve();
    return 0;
}
gdfgdfgf

Details

answer.code:70:1: error: ‘gdfgdfgf’ does not name a type
   70 | gdfgdfgf
      | ^~~~~~~~