NOI2010 能量采集
来源:互联网 发布:保利地产工资待遇知乎 编辑:程序博客网 时间:2024/05/21 17:38
仅仅求GCD居然就有 80分
然后枚举gcd 容斥下就可以做了
#include <cstdio>#include <cstring>#include <iostream>#include <algorithm>using namespace std;long long f[100000+10];int main(){long long ans=0;int n,m;cin>>n>>m;for(int i=min(n,m);i>=1;i--){f[i]=(long long )(n/i)*(m/i);for(int j=i*2;j<=min(n,m);j+=i)f[i]-=f[j];ans+=f[i]*(i*2-1);}//ans+=2*(gcd(i,j)-1)+1;cout<<ans<<endl;return 0;}
0 0
- NOI2010 能量采集
- BZOJ[Noi2010]能量采集
- 【NOI2010】能量采集
- 2005: [Noi2010]能量采集
- 【NOI2010】【BZOJ2005】能量采集
- [BZOJ2005][Noi2010]能量采集
- [BZOJ2005][Noi2010]能量采集
- bzoj2005【NOI2010】能量采集
- 能量采集[NOI2010][Codevs1937]
- NOI2010 能量采集
- Bzoj2005[Noi2010]能量采集
- [bzoj2005][Noi2010]能量采集
- 2005: [Noi2010]能量采集
- 【NOI2010】bzoj2005 能量采集
- BZOJ2005 [Noi2010]能量采集
- bzoj2005[Noi2010]能量采集
- 【bzoj2005】[Noi2010]能量采集
- bzoj2005 [Noi2010]能量采集
- 自定义Android圆点指示器
- java IO流
- 阅读程序(4)
- R语言学习
- CUDA7.5+opencv2.4.11+vs2013+TBB 环境配置
- NOI2010 能量采集
- Android HttpURLConnection的简单使用
- Android SO逆向1-ARM介绍
- java中this和super关键字的用法及其区别
- Ehcache系列经典4
- 去掉div裏面的滚动条但是还可以滚动
- 常用排序算法详解
- Bootstrap 选项卡和面板
- Linux下Clion编译Cmake报错的解决方案