国产探花免费观看_亚洲丰满少妇自慰呻吟_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;}
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 修文县| 麻栗坡县| 铁岭县| 西丰县| 台中县| 修水县| 财经| 乳源| 革吉县| 永仁县| 秦皇岛市| 峨眉山市| 凤凰县| 宣化县| 乡城县| 安龙县| 金川县| 孟州市| 密山市| 泉州市| 淳化县| 江永县| 五河县| 松阳县| 舞钢市| 理塘县| 博野县| 濮阳县| 天气| 松阳县| 永靖县| 炎陵县| 和平区| 罗城| 黎平县| 拉萨市| 新沂市| 额尔古纳市| 永仁县| 屏山县| 承德县|