BZOJ1968 [Ahoi2005]COMMON 约数研究
Description

Input
Output
Sample Input
Sample Output
HINT
Source
讨论每个因子的贡献就可以了。
- //It is made by jump~
- #include <iostream>
- #include <cstdlib>
- #include <cstring>
- #include <cstdio>
- #include <cmath>
- #include <algorithm>
- #include <ctime>
- #include <vector>
- #include <queue>
- #include <map>
- #include <set>
- using namespace std;
- typedef long long LL;
- int n,ans;
- inline int getint()
- {
- int w=,q=; char c=getchar();
- while((c<'' || c>'') && c!='-') c=getchar(); if(c=='-') q=,c=getchar();
- while (c>='' && c<='') w=w*+c-'', c=getchar(); return q ? -w : w;
- }
- inline void work(){
- n=getint(); for(int i=;i<=n;i++) ans+=n/i; printf("%d",ans);
- }
- int main()
- {
- work();
- return ;
- }
BZOJ1968 [Ahoi2005]COMMON 约数研究的更多相关文章
- bzoj千题计划170:bzoj1968: [Ahoi2005]COMMON 约数研究
http://www.lydsy.com/JudgeOnline/problem.php?id=1968 换个角度 一个数可以成为几个数的约数 #include<cstdio> #incl ...
- BZOJ1968 [Ahoi2005]COMMON 约数研究 数论
欢迎访问~原文出处——博客园-zhouzhendong 去博客园看该题解 题目传送门 - BZOJ1968 题意概括 求 ΣF(i) (1<=i<=n)N<=1000000 F( ...
- 【数论】bzoj1968 [Ahoi2005]COMMON 约数研究
对于i属于[1,n],i只能成为[1,n]中n/i个数的约数,易证. #include<stdio.h> int n,i; long long ans; int main() { scan ...
- [日常摸鱼]bzoj1968 [Ahoi2005]COMMON 约数研究
题意:记$f(n)$为$n$的约数个数,求$\sum_{i=1}^n f(i)$,$n \leq 10^6$. 我也不知道为什么我要来做这个- 直接枚举每个数会是哪些数的约数-复杂度$O(n log ...
- bzoj1968: [Ahoi2005]COMMON 约数研究(数论)
计算每一个数的贡献就好了..O(N) n/i只有2*sqrtn个取值于是可以优化到O(sqrtn) #include<bits/stdc++.h> #define ll long long ...
- [BZOJ1968][AHOI2005]COMMON约数研究 数学
题目链接:http://www.lydsy.com/JudgeOnline/problem.php?id=1968 直接计算每个因子的贡献就可以了. $Ans=\sum_{i=1}^n[\frac{n ...
- BZOJ1968: [Ahoi2005]COMMON 约数研究 线性筛
按照积性函数的定义筛一下这个积性函数即可. #include <cstdio> #include <algorithm> #define N 1000004 #define s ...
- BZOJ 1968: [Ahoi2005]COMMON 约数研究
1968: [Ahoi2005]COMMON 约数研究 Time Limit: 1 Sec Memory Limit: 64 MBSubmit: 2032 Solved: 1537[Submit] ...
- BZOJ 1968: [Ahoi2005]COMMON 约数研究 水题
1968: [Ahoi2005]COMMON 约数研究 Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://www.lydsy.com/JudgeO ...
随机推荐
- SVN版本回退
[SVN版本回退] 在Windows里,先打开Log面板,根据想要回退的内容,然后选择revert to this revision或者revert changes from this revisio ...
- java 21 - 6 字符缓冲流的特殊方法以及该方法高效复制文件
字符缓冲流的特殊方法: A.BufferedWriter: public void newLine():根据系统来决定换行符 private static void write() throws IO ...
- sqlzoo.net刷题2
Find the largest country (by area) in each continent, show the continent, thename and the area: 找到每个 ...
- 九、Foundation框架中的NSString常用方法
一.NSString的创建 方式1创建常量字符串 NSString *st = @"this is string!"; //这种方式创建的字符串不需要释放 方式2创建空字符串,给予 ...
- 15SpringMvc_在业务控制方法中写入模型变量收集参数,且使用@InitBind来解决字符串转日期类型
之前第12篇文章中提到过在业务控制方法中写入普通变量收集参数的方式,也提到了这种凡方式的弊端(参数很多怎么办),所以这篇文章讲的是在业务控制方法中写入模型变量来收集参数.本文的案例实现的功能是,在注册 ...
- MVC4 WebAPI POST数据问题
api [HttpPost] public string PostAvartos(Test model) { if (model != null) { LoggerHelper.WriteInfo(m ...
- [py] 导入模块 reload(sys)
#!/usr/bin/env python # coding: utf-8 import sys reload(sys) #<------这个是什么意思 sys.setdefault ...
- [py]chr ord
http://www.xuebuyuan.com/2067536.html 也可以help(ord)
- 使用ConfigurationManager类读写配置文件
使用ConfigurationManager类 读写配置文件app.config,以下为代码: view plaincopy to clipboard print? using System; usi ...
- An Introduction to Interactive Programming in Python (Part 1) -- Week 2_3 练习
Mini-project description - Rock-paper-scissors-lizard-Spock Rock-paper-scissors is a hand game that ...