版本比较
题解:P5136 sequence
正文
增加 5 行删除 5 行
18 行未改动19202122232425262728293031323334353637383940414 行未改动46474849505152535436 行未改动18 行未改动#include<iostream>#define IOS ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)using namespace std;const int MOD=998244353;struct Matrix{long long data[2][2];Matrix(){data[0][0]=data[0][1]=data[1][0]=data[1][1]=0;}Matrix(long long a00,long long a01,long long a10,long long a11){data[0][0]=a00;data[0][1]=a01;data[1][0]=a10;data[1][1]=a11;}Matrix operator*(const Matrix& other)const{Matrix result;result.data[0][0]=(data[0][0]*other.data[0][0]%MOD+data[0][1]*other.data[1][0]%MOD)%MOD;result.data[0][1]=(data[0][0]*other.data[0][1]%MOD+data[0][1]*other.data[1][1]%MOD)%MOD;4 行未改动long long* operator[](long long index){return data[index];}const long long* operator[](long long index)const{return data[index];}};36 行未改动18 行未改动19202122232425262728293031323334353637383940414 行未改动46474849505152535436 行未改动18 行未改动#include<iostream>#define IOS ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)using namespace std;const int MOD=998244353;struct Matrix{long long data[2][2];Matrix(){data[0][0]=data[0][1]=data[1][0]=data[1][1]=0;}Matrix(long long a00,long long a01,long long a10,long long a11){data[0][0]=a00;data[0][1]=a01;data[1][0]=a10;data[1][1]=a11;}Matrix operator*(const Matrix& other)const{Matrix result;result.data[0][0]=(data[0][0]*other.data[0][0]%MOD+data[0][1]*other.data[1][0]%MOD)%MOD;result.data[0][1]=(data[0][0]*other.data[0][1]%MOD+data[0][1]*other.data[1][1]%MOD)%MOD;4 行未改动long long* operator[](long long index){return data[index];}const long long* operator[](long long index)const{return data[index];}};36 行未改动