提交记录 21418


用户 题目 状态 得分 用时 内存 语言 代码长度
jcer114514 noip18e. 【NOIP2018】填数游戏 Accepted 100 41.69 us 36 KB C++17 647 B
提交时间 评测时间
2024-03-18 17:08:23 2024-03-18 17:08:29
#include<bits/stdc++.h>
#define mod 1000000007
#define int long long
#define rep(i,a,b) for(int i(a);i<=(b);++i)
#define req(i,a,b) for(int i(a);i>=(b);--i)
using namespace std;
int ans;
int qpow(int x,int y)
{
	if(y==1)return x;if(!y)return 1;
	int res=qpow(x,y>>1);
	return (y&1)?res*res%mod*x%mod:res*res%mod;
}
signed main()
{
	int n,m;cin>>n>>m;
	if(n>m)swap(n,m);
	if(n==1) ans=qpow(2,m);
	else if(n==2) ans=qpow(3,m-1)*4%mod;
	else if(n==3) ans=qpow(3,m-3)*112%mod;
	else if(n==m) ans=(qpow(8,n)*83%mod+qpow(2,n+7)*5)%mod*190104168%mod;
	else ans=(qpow(8,n)*83%mod+qpow(2,n+8))%mod*qpow(3,-1+m-n)%mod*570312504%mod;
	cout<<ans;
	return 0;
}

CompilationN/AN/ACompile OKScore: N/A

Testcase #141.69 us36 KBAcceptedScore: 5

Testcase #237.3 us36 KBAcceptedScore: 5

Testcase #336.45 us36 KBAcceptedScore: 5

Testcase #436.3 us36 KBAcceptedScore: 5

Testcase #536.69 us36 KBAcceptedScore: 5

Testcase #636.55 us36 KBAcceptedScore: 5

Testcase #735.92 us36 KBAcceptedScore: 5

Testcase #836.39 us36 KBAcceptedScore: 5

Testcase #936.93 us36 KBAcceptedScore: 5

Testcase #1036.48 us36 KBAcceptedScore: 5

Testcase #1136.02 us36 KBAcceptedScore: 5

Testcase #1236.47 us36 KBAcceptedScore: 5

Testcase #1336.31 us36 KBAcceptedScore: 5

Testcase #1436.73 us36 KBAcceptedScore: 5

Testcase #1536.53 us36 KBAcceptedScore: 5

Testcase #1636.5 us36 KBAcceptedScore: 5

Testcase #1736.17 us36 KBAcceptedScore: 5

Testcase #1835.94 us36 KBAcceptedScore: 5

Testcase #1935.91 us36 KBAcceptedScore: 5

Testcase #2036.02 us36 KBAcceptedScore: 5


Judge Duck Online | 评测鸭在线
Server Time: 2024-12-05 10:27:56 | Loaded in 1 ms | Server Status
个人娱乐项目,仅供学习交流使用 | 捐赠