/ SeriousOJ /

Record Detail

Time Exceeded


  
# Status Time Cost Memory Cost
#1 Accepted 2ms 540.0 KiB
#2 Accepted 2ms 540.0 KiB
#3 Accepted 2ms 516.0 KiB
#4 Accepted 11ms 344.0 KiB
#5 Time Exceeded ≥1068ms ≥332.0 KiB
#6 Time Exceeded ≥1074ms ≥328.0 KiB
#7 Time Exceeded ≥1060ms ≥528.0 KiB
#8 Time Exceeded ≥1066ms ≥536.0 KiB

Code

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

int max_div(long long int num) {
    long long int highest = 1;
    long long int x = num / 2;
    for (long long int i = x; i >= 1; i--) {
        if (num % i == 0) {
            highest = i;
            break;
        }
    }
    return highest;
}
int main(){

    long long int t;
    cin >> t;
    while (t--){
        long long int n;
        cin >> n;
        
        if (n % 2 == 0){
            cout << n/2 << endl;
        }
        else{
            long long 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 17:16:51
Judged At
2024-10-03 13:48:53
Judged By
Score
25
Total Time
≥1074ms
Peak Memory
≥540.0 KiB