hdu4556-Stern-Brocot Tree
来源:互联网 发布:java专业培训机构 编辑:程序博客网 时间:2024/03/29 04:38
http://acm.hdu.edu.cn/showproblem.php?pid=4556
#include<iostream>#include<cstdio>#include<cstring>using namespace std ;#define maxn 1000005#define INT __int64INT ans[ maxn + 1] ;void enlerfun(){memset( ans , 0 , sizeof( ans ) );ans[ 1 ] = 1 ;for( int i = 2 ; i <= maxn ; ++i ){if( !ans[ i ] ){for( int j = i ; j <= maxn ; j += i ){if( !ans[ j ] )ans[ j ] = j ;ans[ j ] = ans[ j ] / i * ( i - 1 ) ;}}ans[ i ] += ans[ i - 1 ] ;}}int main(){int n ;enlerfun() ;while( scanf( "%d" , &n ) != EOF && n ){printf( "%I64d\n" , 2 * ans[ n ] + 1 ) ;}return 0 ;}
- hdu4556-Stern-Brocot Tree
- hdu4556-Stern-Brocot Tree
- hdu4556 西山居四 Stern-Brocot Tree
- hdu4556 Stern-Brocot Tree(欧拉函数递推关系)
- HDU-4556-Stern-Brocot Tree
- hdu 4556 Stern-Brocot Tree
- hdu 4556 Stern-Brocot Tree
- HDOJ 4556 Stern-Brocot Tree
- HDU 4556 Stern-Brocot Tree
- PE 372 【类欧几里德】【Stern-Brocot Tree】
- hdoj 4556 Stern-Brocot Tree(欧拉函数)
- Farey序列(Stern-Brocot tree的衍生)
- Hdu 6209 The Intersection(Stern-Brocot tree+二分)
- hdu 4556 Stern-Brocot
- HDOJ 题目4556Stern-Brocot Tree(数学,欧拉函数)
- hdoj Stern-Brocot Tree 4556 (欧拉函数打表)
- [Codeforces 585C] Alice, Bob, Oranges and Apples (Stern-Brocot Tree + 更相减损法)
- Farey序列与Stern-Brocot树
- ./configure make make install分别是什么意思呀
- Hibernate框架下调用Mysql存储过程
- UML 类图关系(泛化 、继承、实现、依赖、关联、聚合、组合)
- oracle 重定义表
- 浅析VB.NET方法创建
- hdu4556-Stern-Brocot Tree
- session_start()的配置 php.ini 中 session.auto_start
- hdu4556-Stern-Brocot Tree
- 2013年6月5日CSDN讲座
- http协议详解
- hdu2824-The Euler function
- Android 中的 Service 全面总结
- 不做就不做,要做就全力以赴...
- TCP/IP详解卷1:协议(第三章:IP:网际协议)