标签:std print sum close iostream div open namespace +=
AC代码:
#include <iostream> #include <cstdio> #include <cmath> using namespace std; long int hanshu(long int a) { long int sum=1; long int bi=(int)sqrt((double)a); for(long int i=2;i<=bi;i++) { if(a%i==0) { sum+=i; if(i!=a/i) sum+=a/i; } } return sum; } int main(void) { freopen("in.txt","r",stdin); long long n; scanf("%lld",&n); while(n--) { long int a,sum; scanf("%ld",&a); sum=hanshu(a); printf("%lld\n",sum); } fclose(stdin); return 0; }
标签:std print sum close iostream div open namespace +=
原文地址:https://www.cnblogs.com/phaLQ/p/10046430.html