解方程
1 #include<iostream> 2 #include<cstdio> 3 #include<cstring> 4 #include<cmath> 5 #include<algorithm> 6 using namespace std; 7 #define ll long long 8 #define mod 1000000007 9 int t; 10 11 int main(){ 12 scanf("%d",&t); 13 while(t--){ 14 int n; 15 scanf("%d",&n); 16 int p=sqrt(n); 17 if(n%4){ 18 printf("0 0\n"); 19 continue; 20 } 21 if(p*p==n){ 22 printf("infty\n"); 23 continue; 24 } 25 ll q=(ll)n/4; 26 int cnt=0; 27 ll ans=0; 28 for( int i=1; (ll)i*i<=q; i++ ) if(q%i==0){ 29 cnt++; 30 ans=(ans+(ll)q*(i+(q/i)))%mod; 31 32 } 33 printf("%d %lld\n",cnt,ans); 34 } 35 36 return 0; 37 }
有些目标看似很遥远,但只要付出足够多的努力,这一切总有可能实现!