NC25105. [USACO 2006 Ope l]Bedtime Reading
描述
输入描述
Line 1: A single integer, I
输出描述
Line 1: The sum of all of I's divisors.
示例1
输入:
12
输出:
28
C++(clang++ 11.0.1) 解法, 执行用时: 7ms, 内存消耗: 448K, 提交时间: 2023-05-15 16:34:39
#include<iostream> #include<cmath> using namespace std; int main(){ int I;int sum=0; cin>>I; for(int i=1;i<=I;i++){ if(I%i==0){sum=sum+i;} } cout<<sum; return 0; }