QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#623112#19. Pyramidbennysmithynunta0 0ms0kbC++14973b2024-10-09 10:13:562024-10-09 10:13:57

Judging History

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

  • [2024-10-09 10:13:57]
  • 评测
  • 测评结果:0
  • 用时:0ms
  • 内存:0kb
  • [2024-10-09 10:13:56]
  • 提交

answer

#include <iostream>
#include <vector>

int qthDivisible(std::vector<int>& A, int rank){
    int i = 0;
    int num = 0;
    while(i < rank){
        for(int j = 0; j < A.size(); j++){
            if(num % A.at(j) == 0){
                i++;
                break;
            }
        }
        num++;
    }
    return num+1;
}

int main(){
    int N, M;
    std::vector <int>A;
    std::vector <int>Q;
    std::cout << "Enter N, M: ";
    std::cin >> N >> M;
    std::cout << "Enter N integers: ";
    int temp = -1;
    for(int i = 0; i < N; i++){
        std::cin >> temp;
        A.push_back(temp);
    }       
    std::cout << "Enter Q integers: ";
    for(int i = 0; i < M; i++){
        std::cin >> temp;
        Q.push_back(temp);
    }
    std::cout << "\n\n";

    for(int i = 0; i < Q.size(); i++){ //go thru every Q
        int solution = qthDivisible(A, Q.at(i));
        std::cout << solution << std::endl;
    }

}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Time Limit Exceeded

Test #1:

score: 0
Time Limit Exceeded

input:

4 50
160170927438273 13 15 2
180423
745688
64848
693929
253438
780397
629077
665503
952292
416311
97760
364091
781335
228858
358112
941489
396993
297182
325269
64984
157360
594741
524328
211765
398912
526184
535991
806805
694217
319687
440663
611862
949865
170323
966443
374437
171193
693136
727390
5...

output:

Enter N, M: Enter N integers: 

result:


Subtask #2:

score: 0
Time Limit Exceeded

Test #6:

score: 0
Time Limit Exceeded

input:

2 50
17771136336081539 3
330463005200449932
39583119993410600
227422596111515420
5216990832097530
330562395720880314
46911693168131678
75561024860927522
233087263213182367
1041638514989081
273998571464130991
61121009404587104
61519075469706514
52949685546801822
154724493736712593
124625756731535803
...

output:

Enter N, M: Enter N integers: 

result:


Subtask #3:

score: 0
Skipped

Dependency #1:

0%