摘要: 完全是套用polya模版……#include#include#include#include#include#includeusing namespace std;int prime[30005],m,mod=1000000007;bool f[30005];__int64 extend(__int64 a,__int64 b,__int64 &x,__int64 &y){ __int64 d; if(b==0) { x=1;y=0; return a; } else { d=extend(b,a%b,x,y); __int64 t=x; x=y; y=t-a/b*y; } r 阅读全文
posted @ 2013-07-18 19:32 _随心所欲_ 阅读(214) 评论(0) 推荐(0)
摘要: 计算几何,主要是排序问题,其他都很好做……#include#include#include#include#include#includeusing namespace std;struct seg{ double k,b; double x1,y1; double x2,y2; bool flag;}an[10002];int same(double a,double b){ if(fabs(a-b)>1e-8) return 0; return 1;}bool less(double a,double b){ if(a-b>1e-8) return 0; return 1;}b 阅读全文
posted @ 2013-07-18 16:32 _随心所欲_ 阅读(212) 评论(0) 推荐(0)
摘要: 这题当时竟然没看啊……找规律:求和m+m+m-1+m-1+……前n项#include#include#include#include#include#includeusing namespace std;int main(){ __int64 n,m,i,sum; while(scanf("%I64d%I64d",&m,&n)!=EOF) { sum=0; for(i=0;i<n/2;i++) { sum+=m-i; } sum=2*sum+m-n/2; printf("%I64d\n",sum); } return 0;} 阅读全文
posted @ 2013-07-18 14:45 _随心所欲_ 阅读(309) 评论(0) 推荐(0)
摘要: ……但是没仔细看,直接跳过了这题直接枚举就可以过了#include#include#include#include#include#includeusing namespace std;__int64 a[5];int n;__int64 swap(__int64 x){ if(n==1) return a[1]*x+a[0]; else if(n==2) return a[2]*x*x+a[1]*x+a[0]; else if(n==3) return a[3]*x*x*x+a[2]*x*x+a[1]*x+a[0]; else return a[4]*x*x*x*x+a[3]*x*x*x+a 阅读全文
posted @ 2013-07-18 14:07 _随心所欲_ 阅读(333) 评论(0) 推荐(0)
摘要: 这题在比赛的时候不知道怎么做,后来看了别人的解题报告,才知道公式sn=(a+sqrt(b))^n+(a-sqrt(b))^n;具体推导 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 using namespace std; 8 struct ma 9 {10 __int64 a[2][2];11 void init()12 {13 a[0][0]=a[1][1]=1;14 a[0][1]=a[1][0]=0;15 }16 };17 int m... 阅读全文
posted @ 2013-07-18 11:27 _随心所欲_ 阅读(282) 评论(0) 推荐(0)