• 轮状病毒


    #include<iostream>
    #include<cstdio>
    #include<cstdlib>
    #include<cstring>
    #include<cmath>
    #include<algorithm>
    #include<queue>
    #include<map>
    #include<set>
    #include<vector>
    #define R register
    #define next kdjadskfj
    #define debug puts("mlg")
    #define mod 998244353
    #define Mod(x) ((x%mod+mod)%mod)
    using namespace std;
    typedef long long ll;
    typedef long double ld;
    typedef unsigned long long ull;
    inline ll read();
    inline void write(ll x);
    inline void writeln(ll x);
    inline void writesp(ll x);
    struct node{
    	ll h,num[300];
    	bool operator <(node x)const{
    		if(h!=x.h) return h<x.h;
    		for(R ll i=h;i>=1;i--) if(num[i]!=x.num[i]) return num[i]<x.num[i];
    	}
    	inline void Write(){
    		for(R ll i=h;i;i--) write(num[i]);putchar('
    ');
    	}
    }a,b,c;
    ll n;
    node operator *(node x,node y){
    	static node z;
    	z.h=x.h+y.h-1;
    	memset(z.num,0,sizeof z.num);
    	for(R ll i=1;i<=x.h;i++){
    		for(R ll j=1;j<=y.h;j++){
    			z.num[i+j-1]+=x.num[i]*y.num[j];
    			z.num[i+j]+=z.num[i+j-1]/10;
    			z.num[i+j-1]%=10;
    		}
    	}
    	if(z.num[z.h+1]) ++z.h;
    	return z;
    }
    node operator +(node x,node y){
    	static node z;
    	z.h=max(x.h,y.h);
    	memset(z.num,0,sizeof z.num);
    	for(R ll i=1;i<=z.h;i++){
    		z.num[i]+=x.num[i]+y.num[i];
    		z.num[i+1]+=z.num[i]/10;
    		z.num[i]%=10;
    	}
    	if(z.num[z.h+1]) ++z.h;
    	return z;
    }
    node operator -(node x,node y){
    	static node z;
    	if(x<y) swap(x,y);
    	z.h=x.h;
    	memset(z.num,0,sizeof z.num);
    	for(R ll i=1;i<=y.h;i++){
    //		if(x.num[i]<y.num[i]) x.num[i]+=10,x.num[i+1]--;
    		z.num[i]=x.num[i]-y.num[i];
    	}
    	for(R ll i=y.h+1;i<=x.h;i++){
    		if(x.num[i]<0) x.num[i]+=10,--x.num[i+1];
    		z.num[i]=x.num[i];
    	}
    	if(!z.num[z.h])--z.h;
    	return z;
    }
    int main(){
    	n=read();
    	a.h=1;a.num[1]=1;
    	b.h=1;b.num[1]=3;
    	for(R ll i=2;i<=n;i++){
    		c=a+b;
    		a=b;b=c;
    	}
    	a=a*a;
    	node d;
    	d.h=1;d.num[1]=4;
    	if(!(n&1))a=a-d;
    	a.Write();
    }
    inline ll read(){ll x=0,t=1;char ch=getchar();while(ch<'0'||ch>'9'){if(ch=='-') t=-1;ch=getchar();}while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}return x*t;}
    inline void write(ll x){if(x<0){putchar('-');x=-x;}if(x<=9){putchar(x+'0');return;}write(x/10);putchar(x%10+'0');}
    inline void writesp(ll x){write(x);putchar(' ');}
    inline void writeln(ll x){write(x);putchar('
    ');}
    
  • 相关阅读:
    OPENCV(3) —— 对XML和YAML文件实现I/O 操作
    OPENCV(2) —— Basic Structures(二)
    OPENCV(2) —— Basic Structures(一)
    OPENCV(1)
    转:计算机视觉相关领域代码集
    ScSPM
    ScSPM & LLC
    Spatial Pyramid Matching
    Convolution & Pooling exercise
    Restricted Boltzmann Machines
  • 原文地址:https://www.cnblogs.com/ylwtsq/p/13507443.html
Copyright © 2020-2023  润新知