LightOj 1336(Sigma Function)

lightoj 1336

题目大意:

已知  x=p1e1p2e2pkek σ(x)=i=1kpiei+11pi1 ;
x[1,n] 中, x 为偶数的个数;

思路:

σ(x)为偶数,只要存在因子 piei+11pi1 为偶数即成立;
x 存在素因子为奇数次;
(1)t=p2n, 即 t 的因子都为偶数次;
(2)t=2q2n;
2ei+1121=2p,2ei+1=2p+1 ; 恒不成立,即因子 2 的个数不影响结果,排除2为奇数个的情况;

ans=p+q ;

#include <iostream>
#include <cstdio>
#include  <cmath>
#define LL long long

using namespace std;

int main()
{
    int T;
    scanf("%d", &T);

    for (int cas = 1; cas <= T; cas++)
    {
        LL n;
        scanf("%lld", &n);

        int ans = (int)sqrt(n * 1.0) + (int)sqrt(n * 1.0 / 2);

        printf("Case %d: %lld\n", cas, n - ans);
    }
}

/*
1000000000000
*/
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值