1 solutions
-
0
#include<bits/stdc++.h> using namespace std; /* 思路: 1、求输入数n的因子和 2、如果n等于n的因子和,输出yes */ int main() { int n, sum = 0; cin >> n; //求n的因子和 for(int i = 1; i <= n/2; i++){ if(n % i == 0){ sum += i; } } //如果n等于n的因子和,输出yes if(sum == n){ cout << "yes"; } else { cout << "no"; } return 0; }
Information
- ID
- 1195
- Time
- 1000ms
- Memory
- 512MiB
- Difficulty
- 10
- Tags
- # Submissions
- 10
- Accepted
- 3
- Uploaded By