light 1007

区间内逐个用欧拉函数求scoreTLE卡, 用了筛选法  WA卡, 用了long long  WA又卡,最后又在网上看了看unsigned过了

#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
typedef unsigned long long ULL;
int in[100010][2];
ULL score[5000010];
void scor(int max_n)
{
    memset(score, 0, sizeof score);
    score[1] = 1;
    for(int i = 2; i <= max_n; i++)
    {
        if(!score[i])
        {
            for(int j = i; j <= max_n; j+=i)
            {
                if(!score[j])
                {
                    score[j] = j;
                }
                score[j] = score[j]/i*(i-1);
            }
        }
    }
    for(int i = 2; i <= max_n; i++)
    {
        score[i] = score[i] * score[i] + score[i-1];
    }
}

int main()
{
    int T, a, b, CA = 1, max_n = -1;

    scanf("%d", &T);
    for(int i = 0; i < T; i++)
    {
        scanf("%d%d", &a, &b);
        in[i][0] = a, in[i][1] = b;
        int mx = max(a, b);
        max_n = max(mx, max_n);
    }
    scor(max_n);
    for(int i = 0; i < T; i++)
    {
        printf("Case %d: %llu\n", CA++, score[in[i][1]] - score[in[i][0] - 1]);
    }

    return 0;
}


select v.道路名称 AS road_name, count(1) totalNum, sum( decode (substr(fxjg,1,6),'210200', 1,0)) dlNum, sum( decode (substr(fxjg,1,6),'210202', 1,0)) zsNum, sum( decode (substr(fxjg,1,6),'210203', 1,0)) xgNum, sum( decode (substr(fxjg,1,6),'210204', 1,0)) shkNum, sum( decode (substr(fxjg,1,6),'210211', 1,0)) gjzNum, sum( decode (substr(fxjg,1,6),'210217', 1,0)) gxNum, sum( decode (substr(fxjg,1,6),'210212', 1,0)) lsNum, sum( decode (substr(fxjg,1,6),'210216', 1,0)) jcNum, sum( decode (substr(fxjg,1,6), '210200', 0, '210202', 0, '210203', 0, '210204', 0, '210211', 0, '210217', 0, '210212', 0, '210216', 0,null,0 ,1)) qtNum from (select case when WFDD='70132' and wfdz='悦彩街' then '70132-1032' when WFDD='70132' and wfdz<>'悦彩街' then '70132A' when WFDD='78000' and wfdz='善水街' then '78000-1004' when WFDD='78000' and wfdz='凌滨路' then '78000-1011' when WFDD='78000' and wfdz<>'凌滨路' and wfdz<>'善水街' then '78000A' when WFDD='70005' and instr(wfdz,'绘春街')>0 then '70005-1007' when WFDD='70005' and instr(wfdz,'绘春街')=0 then '70005A' when WFDD='60037' and instr(wfdz,'滨海中路')>0 then '60037-1300' when WFDD='60037' and wfdz='滨海路动物园二期路段' then '60310' when WFDD='63084' and instr(wfdz,'北站东路')>0 then '63084-1002' when WFDD='63084' and instr(wfdz,'北站西路')>0 then '63084-1003' when WFDD='63084' and instr(wfdz,'北站西路')=0 and instr(wfdz,'北站东路')=0 then '63084A' when WFDD='63087' and instr(wfdz,'站北东路')>0 then '63087-1002' else wfdd end WFDD,wfdz,fxjg ,lrsj from trff_DL.VIEW_vio_violation_SWTX t where lrsj between to_date("2025-04-05 00:00:00",'yyyy-mm-dd hh24:mi:ss') and to_date("2025-04-01 00:00:00",'yyyy-mm-dd hh24:mi:ss') and substr(FXjg,1,4)= '2102' and wfxw='1039' union all select case when WFDD='70132' and wfdz='悦彩街' then '70132-1032' when WFDD='70132' and wfdz<>'悦彩街' then '70132A' when WFDD='78000' and wfdz='善水街' then '78000-1004' w
04-03
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值