HDU-4554 叛逆的小明 水题
2013-05-21 13:06
190 查看
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4554
本来是拿这题的FB的,结果脑残把变量命敲错了,wa一次。。。。
本来是拿这题的FB的,结果脑残把变量命敲错了,wa一次。。。。
//STATUS:C++_AC_0MS_228KB #include <functional> #include <algorithm> #include <iostream> //#include <ext/rope> #include <fstream> #include <sstream> #include <iomanip> #include <numeric> #include <cstring> #include <cassert> #include <cstdio> #include <string> #include <vector> #include <bitset> #include <queue> #include <stack> #include <cmath> #include <ctime> #include <list> #include <set> #include <map> using namespace std; //define #define pii pair<int,int> #define mem(a,b) memset(a,b,sizeof(a)) #define lson l,mid,rt<<1 #define rson mid+1,r,rt<<1|1 #define PI acos(-1.0) //typedef typedef __int64 LL; typedef unsigned __int64 ULL; //const const int N=1000010; const int INF=0x3f3f3f3f; const int MOD=256,STA=8000010; const LL LNF=1LL<<60; const double EPS=1e-8; const double OO=1e15; const int dx[4]={-1,0,1,0}; const int dy[4]={0,1,0,-1}; const int day[13]={0,31,28,31,30,31,30,31,31,30,31,30,31}; //Daily Use ... inline int sign(double x){return (x>EPS)-(x<-EPS);} template<class T> T gcd(T a,T b){return b?gcd(b,a%b):a;} template<class T> T lcm(T a,T b){return a/gcd(a,b)*b;} template<class T> inline T Min(T a,T b){return a<b?a:b;} template<class T> inline T Max(T a,T b){return a>b?a:b;} template<class T> inline T Min(T a,T b,T c){return min(min(a, b),c);} template<class T> inline T Max(T a,T b,T c){return max(max(a, b),c);} template<class T> inline T Min(T a,T b,T c,T d){return min(min(a, b),min(c,d));} template<class T> inline T Max(T a,T b,T c,T d){return max(max(a, b),max(c,d));} //End LL phi ,f ; int n; void phitable(int n) { int i,j; for(i=0;i<=n;i++)phi[i]=0; phi[1]=1; for(i=2;i<=n;i++)if(!phi[i]){ for(j=i;j<=n;j+=i){ if(!phi[j])phi[j]=j; phi[j]=phi[j]/i*(i-1); } } } int main() { // freopen("in.txt","r",stdin); int i,j,m=N-9; phitable(m); f[1]=2; for(i=2;i<=m;i++) f[i]=f[i-1]+phi[i]; for(i=1;i<=m;i++) f[i]+=f[i]-1; while(~scanf("%d",&n)) { printf("%I64d\n",f ); } return 0; }
相关文章推荐
- hdu 4554 叛逆的小明
- 抓起根本(二)(hdu 4554 叛逆的小明 hdu 1002 A + B Problem II,数字的转化(反转),大数的加法......)
- hdu 4554 叛逆的小明
- hdu 4554 叛逆的小明
- HDU 4554 叛逆的小明
- hdu 4554 叛逆的小明
- HDU 4554 叛逆的小明(西山居挑战赛)
- hdu-4554-叛逆的小明
- 抓起根本(二)(hdu 4554 叛逆的小明 hdu 1002 A + B Problem II,数字的转化(反转),大数的加法......)
- hdu 4544 叛逆的小明 -- 数字反转 和 hdu 2074 叠筐(水题)
- HDU-4554-叛逆的小明
- hdoj 4554 叛逆的小明
- HDU 2096 小明A+B --- 水题
- 杭电4554 叛逆的小明
- HDU 2096-小明A+B-水题
- [4554]:叛逆的小明
- HDU ACM 4554 叛逆的小明
- hdoj 4554 叛逆的小明
- hdu 4931 Happy Three Friends(水题)
- hdu 2057 A + B Again (水题)