λ¬Έμ
μ½λ
#include <iostream>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
int T; cin >> T;
while (T--) {
bool check[10001] = { false };
int sum = 0;
int N; cin >> N;
for (int i = 1; i<=N/2; i++) {
if (N % i == 0) check[i] = true;
}
for (int i = 1; i <= N/2; i++) {
if (check[i])sum += i;
}
if (sum > N) cout << "Abundant" << "\n";
else if (sum < N) cout << "Deficient" << '\n';
else cout << "Perfect" << "\n";
}
}
νμ΄
Nμ μ½μλ Nμ λ°μΌλ‘ λλ κ²λ³΄λ€ μ΄κ³Όλ κ°μ μ½μκ° λ μ μλ€.(Nμ ν¬ν¨) ex) 10-> 1,2,5,10
'Algorithm π§π»βπ» > λ°±μ€(BOJ)' μΉ΄ν κ³ λ¦¬μ λ€λ₯Έ κΈ
[λ°±μ€,c++] 14621λ² - λλ§ μλλ μ°μ (0) | 2021.11.11 |
---|---|
[λ°±μ€,c++] 14588λ² - Line Friends (Small) (0) | 2021.11.11 |
[λ°±μ€,c++] 14567λ² - μ μκ³Όλͺ© (0) | 2021.11.11 |
[λ°±μ€,c++] 14502λ² - μ°κ΅¬μ (0) | 2021.11.11 |
[λ°±μ€,c++] 9465λ² - μ€ν°μ»€ (0) | 2021.11.10 |
[λ°±μ€,c++] 14496λ² - κ·Έλ,κ·Έλ¨Έκ° λμ΄ (0) | 2021.11.07 |
λκΈ