Sigma Function LightOJ - 1336(唯一分解 + 思维 + 等比数列求和公式)

Sigma Function LightOJ - 1336

题意&&思路:

传送门

反思

打完表,其实已经出结果了,嗨嗨。。。。。

AC(附带打表代码)

#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <cmath>
#define pb push_back
#define sz(a) (int)a.size()
#define For(i,x,y) for(int i=(x); i<=(y); i++)
#define fori(i,x,y) for(int i=(x); i<(y); i++)
using namespace std;
typedef long long ll;
//const int maxn = 1e6+10;
//vector<ll>prime_orl, prime, prime_num;
//int vis[maxn];
//void table(){
//    fori(i,2,maxn)if(!vis[i]){
//        prime_orl.pb(i);
//        for(int j = i*2; j<maxn; j += i)vis[j] = 1;
//    }
//}
//void divide(ll x){
//    prime_num.clear();
//    prime.clear();
//    if(x == 1)return ;
//    for(ll i = 0; prime_orl[i]*prime_orl[i] <= x && i <sz(prime_orl); i++){
//        ll pri = prime_orl[i], cnt = 0;
//        if(x % pri == 0){
//            prime.pb(pri);
//            while(x % pri == 0){
//                cnt++;
//                x /= pri;
//            }
//            prime_num.pb(cnt);
//        }
//    }
//    if(x>1){prime.pb(x); prime_num.pb(1);}
//}
int main()
{
//    table();
//    cout<<1<<"    odd"<<endl;
//    int tot = 0;
//    for(int i=2; i<=1000; i++){
//        divide(i);
//        ll ans = 1;
//        fori(k, 0, sz(prime)){
//            ll pri = prime[k];
//            ll dow = pri-1;
//            ll up = pri;
//            fori(j,0,prime_num[k]) up *= pri;
//            up -= 1;
//            ans *= (up / dow);
//        }
//        //cout<<i<<endl;
        if(ans%2==0)cout<<"    even"<<endl,tot++;
        else cout<<"        odd"<<endl;
//        if(ans%2){
//            cout<<i<<"        odd"<<endl;
//            cout<<sz(prime_num)<<"     prime_num"<<endl;
//            cout<<"i--------even_numssss"<<endl;
//            cout<<i<<' '<<tot<<endl;
//            cout<<"----------------------------"<<endl;
//            cout<<endl;
//        }else tot++;
//    }
    //ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int tt, kase = 0;scanf("%lld", &tt);//cin>>tt;
    while(tt--){
        ll n;scanf("%lld", &n);//cin>>n;
        ll ans = n - (ll)sqrt(n) - (ll)sqrt(n/2);
        printf("Case %d: %lld\n", ++kase, ans);
        //cout<<ans<<endl;
    }
    return 0;
}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值