Time Exceeded
Code
//Fahmidur Rahman Nafi 62 [i]
#include <bits/stdc++.h>
using namespace std;
long long int max_div(long long int num){
long long int largest = 1;
if (num % 2 == 0)
return num / 2;
for (long long int i = num/2; i >= 1; i--){
if (num % i == 0){
largest = i;
break;
}
}
return largest;
}
int main() {
long long int t;
cin >> t;
while (t--) {
long long int n;
cin >> n;
cout << max_div(n) << endl;
}
return 0;
}
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:31:27
- Judged At
- 2024-11-11 03:32:10
- Judged By
- Score
- 25
- Total Time
- ≥1069ms
- Peak Memory
- ≥540.0 KiB