QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#348166#8337. Counter Reset Problemucup-team346#Compile Error//C++141.9kb2024-03-09 17:18:302024-03-09 17:18:31

Judging History

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

  • [2024-03-09 17:18:31]
  • 评测
  • [2024-03-09 17:18:30]
  • 提交

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][2],sum[5005][1050][2][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] = 1;
    int ret = 0;
    for(int i = 1;i <= n;i ++){
        for(int S = 0;S < (1 << 10);S ++){
            for(int id = 0;id < 2;id ++){
                for(int l0 = 0;l0 < 2;l0 ++){
                    for(int cur = 0;cur <= (id ? s[i] - '0' : 9);cur ++){
                        int val = (l0 ? 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'][l0 && cur == 0],f[i - 1][S][id][l0]);
                        Add(sum[i][(S | (1 << cur)) & (M << cur) & M2][id && cur == s[i] - '0'][l0 && cur == 0],(1ll * f[i - 1][S][id][l0] * val % P + sum[i - 1][S][id][l0]) % P);
                    }
                }
            }
        }
    }
    for(int S = 0;S < (1 << 10);S ++){
        for(int id = 0;id < 2;id ++){
            for(int l0 = 0;l0 < 2;l0 ++){
                Add(ret,sum[n][S][id][l0]);
            }
        }
    }
    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;
}
asdasdasdas

详细

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