22196 约数之和
约数之和
https://ac.nowcoder.com/acm/problem/22196
#include<bits/stdc++.h> using namespace std; int main() { int n,i,a=0; cin>>n; for(i=1;i<=n;i++) if(n%i==0) a+=i; cout<<a<<endl; return 0; }
约数之和
https://ac.nowcoder.com/acm/problem/22196
#include<bits/stdc++.h> using namespace std; int main() { int n,i,a=0; cin>>n; for(i=1;i<=n;i++) if(n%i==0) a+=i; cout<<a<<endl; return 0; }
相关推荐