只对了4个点,其它都RE了,dl求助!!!

P3955 [NOIP2017 普及组] 图书管理员

Jack2007Q @ 2019-09-21 19:17:17

代码附上:

#include <iostream>
#include <cmath>
#include <algorithm>
using namespace std;
struct node {
    long long num , id;
}b[10000000];
int c[10] = {0 , 10 , 100 , 1000 , 10000 , 100000 , 1000000};
int main(){
    int n , m;
    cin >> n >> m;
    long long a[n];
    for(int i = 0; i < n; i++){
        cin >> a[i];
    }
    for(int i = 0; i < m; i++){
        cin >> b[i].num >> b[i].id;
    }
    sort(a , a + n);
    for(int i = 0; i < m; i++){
        bool flag = false;
        for(int j = 0; j < n; j++){
            if(b[i].id == a[j] % c[b[i].num]){
                cout << a[j] << endl;
                flag = true;
                break;
            }
        }
        if(flag == false){
            cout << -1 << endl;
        }
    }
    return 0;
}

dalao 求助!


by Plus_Ultra @ 2019-09-21 19:27:54

您的讨论怎么矮了一截


by 斗神_君莫笑 @ 2019-09-21 19:38:24

@Jack2007Q 1e7的ll数组是什么鬼?


by Jack2007Q @ 2019-10-02 11:41:30

@Plus_Ultra

???


by hedan @ 2019-10-02 14:04:23


by Jack2007Q @ 2019-10-02 14:04:37

AC了,谢谢巨佬!!!


|