首页 > 其他 > 详细

百度之星初赛A hdu6108

时间:2017-08-12 22:00:53      阅读:209      评论:0      收藏:0      [点我收藏+]

1001

 小C的倍数问题

题意:中文题

思路:p-1的因子个数

AC代码:

#include "iostream"
#include "string.h"
#include "stack"
#include "queue"
#include "string"
#include "vector"
#include "set"
#include "map"
#include "algorithm"
#include "stdio.h"
#include "math.h"
#pragma comment(linker, "/STACK:102400000,102400000")
#define ll long long
#define endl ("\n")
#define bug(x) cout<<x<<" "<<"UUUUU"<<endl;
#define mem(a,x) memset(a,x,sizeof(a))
#define mp(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define ft first
#define sd second
#define lrt (rt<<1)
#define rrt (rt<<1|1)
using namespace std;
const long long INF = 1e18+1LL;
const int inf = 1e9+1e8;
const int N=1e5+100;
const ll mod=1e9+7;

ll p,ans;
int main(){
    //ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
    int T; cin>>T;
    while(T--){
        cin>>p;
        ans=0;
        for(ll i=1; i*i<=p-1; ++i){
            if((p-1)%i==0){
                if((p-1)/i!=i) ans++;
                ans++;
            }
        }
        cout<<ans<<endl;
    }
    return 0;
}

 

百度之星初赛A hdu6108

原文:http://www.cnblogs.com/max88888888/p/7351533.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!