标签:size ops ali fast attr oop cst optimize sign
指令集真好玩
#pragma GCC optimize("Ofast") #pragma GCC optimize("unroll-loops") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") #include<cstdio> #include "immintrin.h" #include "emmintrin.h" typedef double db __attribute__ ((__vector_size__(32),__may_alias__)); int n; int main(){ scanf("%d",&n); if(n==1)return puts("0.00000"),0; db x={1,1,1,1}; db ans={0,0,0,0}; db bs={8,8,8,8}; double p=0; unsigned a=1; for(;a<n&&a<=1000000;++a)p+=1./a; db i={a,a+1,a+2,a+3}; for(;a+8<n;a+=8) ans+=x/i,i+=bs; p += (ans[0]+ans[1]+ans[2]+ans[3])*2+1; for(;a<n;++a)p+=1./a; printf("%.5lf\n",p); }
标签:size ops ali fast attr oop cst optimize sign
原文地址:https://www.cnblogs.com/skip1978/p/10352825.html