/ SeriousOJ /

Record Detail

Time Exceeded


  
# Status Time Cost Memory Cost
#1 Accepted 2ms 320.0 KiB
#2 Accepted 2ms 324.0 KiB
#3 Accepted 2ms 532.0 KiB
#4 Accepted 5ms 324.0 KiB
#5 Time Exceeded ≥1092ms ≥512.0 KiB
#6 Time Exceeded ≥1095ms ≥444.0 KiB
#7 Time Exceeded ≥1089ms ≥320.0 KiB
#8 Time Exceeded ≥1073ms ≥532.0 KiB

Code

//Fahmidur Rahman Nafi 62 [i]
#include <bits/stdc++.h>
using namespace std;

int max_div(int num) {
    int highest = 1;
    for (int i = 2; i <= num / 2; i++) {
        if (num % i == 0) {
            highest = i;
        }
    }

    return highest;
}

int main(){
    int t;
    cin >> t;
    while (t--){
        int n;
        cin >> n;
        
        if (n % 2 == 0){
            cout << n/2 << endl;
        }
        else{
            int ans = max_div(n);
            cout << ans << endl;
        }
    }
}

Information

Submit By
Type
Submission
Problem
P1052 Yet Another Array Partition
Contest
Brain Booster #3
Language
C++20 (G++ 13.2.0)
Submit At
2024-05-06 16:15:11
Judged At
2024-10-03 13:50:36
Judged By
Score
25
Total Time
≥1095ms
Peak Memory
≥532.0 KiB