国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

[HDU]2848 The Euler function[歐拉函數][水題]

2019-11-08 03:05:38
字體:
來源:轉載
供稿:網友

PRoblem Description The Euler function phi is an important kind of function in number theory, (n) represents the amount of the numbers which are smaller than n and coprime to n, and this function has a lot of beautiful characteristics. Here comes a very easy question: suppose you are given a, b, try to calculate (a)+ (a+1)+….+ (b)

Input There are several test cases. Each line has two integers a, b (2

#include<stdio.h>#define MAX_N 3000100int phi[MAX_N];void init(){ for(int i=1;i<MAX_N;i++) phi[i]=i; for(int i=2;i<MAX_N;i++) if(phi[i]==i) for(int j=i;j<MAX_N;j+=i) phi[j]=phi[j]/i*(i-1);}int main(){ init();int a,b; while(~scanf("%d%d",&a,&b)){ long long ans=0; for(int i=a;i<=b;i++) ans+=phi[i]; printf("%lld/n",ans); } return 0;}
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 塔河县| 临武县| 务川| 奈曼旗| 扎鲁特旗| 安多县| 巴林右旗| 织金县| 桐梓县| 温州市| 遂川县| 威海市| 陇南市| 高清| 页游| 秦安县| 岫岩| 乐山市| 蓝山县| 墨江| 沙坪坝区| 岳阳市| 多伦县| 安丘市| 神木县| 洪洞县| 宜阳县| 金秀| 青浦区| 武鸣县| 通江县| 镇原县| 绿春县| 德令哈市| 新晃| 望城县| 哈巴河县| 中方县| 拜城县| 东台市| 江门市|