标签:ane other 根据 clu ota 比较 accept title mem
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 277 Accepted Submission(s):
137
思路:若是p进制,设一个数为a1a2a3,若a1a2a3%B==0可以表达成(a1*p^2+a2*p+a3)%B==0----------1式
#define _CRT_SECURE_NO_DEPRECATE #include<iostream> #include<stdio.h> #include<algorithm> #include<queue> #include<set> #include<vector> #include<cstring> #include<string> #include<cmath> using namespace std; vector<int>divisor(int n) { vector<int>res; for (int i = 1; i*i < n;i++) { if (n%i == 0) { res.push_back(i); if (i != n / i)res.push_back(n / i); } } return res; } int p; int main() { int t; scanf("%d",&t); while (t--) { scanf("%d",&p); vector<int>vec = divisor(p - 1); printf("%d\n",vec.size()); } return 0; }
标签:ane other 根据 clu ota 比较 accept title mem
原文地址:http://www.cnblogs.com/ZefengYao/p/7351325.html