zoukankan      html  css  js  c++  java
  • bzoj 2005: [Noi2010]能量采集

    这。。。。。。

    枚举一下、K,然后就出来了K的倍数,用类似容斥的东西加加减减就行了。(说起来好简单啊,,,)

     1 #include<bits/stdc++.h>
     2 #define N 200005
     3 #define LL long long
     4 #define inf 0x3f3f3f3f
     5 #define ls c[x][0]
     6 #define rs c[x][1]
     7 using namespace std;
     8 inline int ra()
     9 {
    10     int x=0,f=1; char ch=getchar();
    11     while (ch<'0' || ch>'9') {if (ch=='-') f=-1; ch=getchar();}
    12     while (ch>='0' && ch<='9') {x=x*10+ch-'0'; ch=getchar();}
    13     return x*f;
    14 }
    15 LL ans;
    16 LL f[N];
    17 int main()
    18 {
    19     int n=ra(),m=ra(),k=min(n,m);
    20     for (int i=k; i>=1; i--)
    21     {
    22         f[i]=(LL)(n/i)*(m/i);
    23         for (int j=i+i; j<=k; j+=i) f[i]-=f[j];
    24         ans+=f[i]*(2*i-1);    
    25     }
    26     cout<<ans;
    27     return 0;
    28 }
  • 相关阅读:
    相关系数
    T检验
    Python模块常用的几种安装方式
    DOM与SAX读取XML方式的不同
    Base64编码
    node.js网页爬虫
    Node.js Express 框架
    Node.js Web 模块
    Node.js GET/POST请求
    Node.js 常用工具
  • 原文地址:https://www.cnblogs.com/ccd2333/p/6482378.html
Copyright © 2011-2022 走看看