T7314 yyy的巧克力(钟)

题目描述

输入输出格式

输入格式:

如图

输出格式:

如图

输入输出样例输入样例#1:

如图

输出样例#1:

如图

说明

如图

n*m-1

我们可以这样想,1*1的巧克力一定是由1*2的掰开的

 1 #include<iostream> 2 #include<cstdio> 3 #include<cstring> 4 #include<cmath> 5 #include<algorithm> 6 #include<queue> 7 #include<stack> 8 #define lli long long  9 using namespace std;10 const int mod=998244353;11 void read(int &n)12 {13     char c='+';int x=0;bool flag=0;14     while(c<'0'||c>'9'){c=getchar();if(c=='-')flag=1;}15     while(c>='0'&&c<='9')16     x=(x<<1)+(x<<3)+c-48,c=getchar();17     flag==1?n=-x:n=x;18 }19 lli n,m;20 int fastmul(int x,int p)21 {22     int now=x;23     int ans=0;24     while(p)25     {26         if(p&1)27         {28             --p;29             ans=(ans+now)%mod;30         }31         p>>=1;32         now=(now+now)%mod;33     }34     return (ans-1)%mod;35 }36 int main()37 {38 //    freopen("bpmp.in","r",stdin);39 //    freopen("bpmp.out","w",stdout);40     //read(n);read(m);41     cin>>n>>m;42     cout<<fastmul(n,m)%mod;43     return 0;44 }

将会错过更好的风景,保持一份平和,保持一份清醒。

T7314 yyy的巧克力(钟)

相关文章:

你感兴趣的文章:

标签云: