ccpc 2018 final G - Pastoral Life in Stardew Valley



#include <iostream>
#include<cstdio>
#include<cstring>
#include<queue>
using namespace std;
#define ll long long
const int N =;
const ll mod = ;
ll c[N][];
void init()
{
c[][] =1ll;
for(int i =;i<N;i++){
for(int j =;j<=;j++){
if(j==||j==i) c[i][j]=1ll;
else c[i][j] = (c[i-][j-]%mod+c[i-][j]%mod)%mod;
}
}
}
int t,n,m;
int main()
{
init();
scanf("%d",&t);
for(int i =;i<=t;i++)
{
scanf("%d%d",&n,&m);
if(n<||m<) printf("Case %d: 0\n",i);
else{
ll x = (c[n][]+c[n][])%mod;
ll y = (c[m][]+c[m][])%mod;
x=(x*y)%mod;
printf("Case %d: %lld\n",i,x);
}
}
return ;
}
ccpc 2018 final G - Pastoral Life in Stardew Valley的更多相关文章
- JOI 2018 Final 题解
题目列表:https://loj.ac/problems/search?keyword=JOI+2018+Final T1 寒冬暖炉 贪心 暴力考虑每相邻两个人之间的间隔,从小到大选取即可 #incl ...
- LOJ#2351. 「JOI 2018 Final」毒蛇越狱
LOJ#2351. 「JOI 2018 Final」毒蛇越狱 https://loj.ac/problem/2351 分析: 首先有\(2^{|?|}\)的暴力非常好做. 观察到\(min(|1|,| ...
- Yandex.Algorithm 2018, final round
Yandex.Algorithm 2018, final round A Smart Vending B LIS vs. LDS C Eat And Walk D Search Engine E Gu ...
- ZOJ 4010 Neighboring Characters(ZOJ Monthly, March 2018 Problem G,字符串匹配)
题目链接 ZOJ Monthly, March 2018 Problem G 题意 给定一个字符串.现在求一个下标范围$[0, n - 1]$的$01$序列$f$.$f[x] = 1$表示存在一种 ...
- ACM ICPC China final G Pandaria
目录 ACM ICPC China final G Pandaria ACM ICPC China final G Pandaria 题意:给一张\(n\)个点\(m\)条边的无向图,\(c[i]\) ...
- HDU 6270 Marriage (2017 CCPC 杭州赛区 G题,生成函数 + 容斥 + 分治NTT)
题目链接 2017 CCPC Hangzhou Problem G 题意描述很清晰. 考虑每个家庭有且仅有$k$对近亲的方案数: $C(a, k) * C(b, k) * k!$ 那么如果在第$1$ ...
- Lyft Level 5 Challenge 2018 - Final Round (Open Div. 2) (前三题题解)
这场比赛好毒瘤哇,看第四题好像是中国人出的,怕不是dllxl出的. 第四道什么鬼,互动题不说,花了四十五分钟看懂题目,都想砸电脑了.然后发现不会,互动题从来没做过. 不过这次新号上蓝名了(我才不告诉你 ...
- Stardew Valley(星露谷物语)Mod开发之路 1环境配置
首先来说明一下,我写这个章节本身也是对学习过程的记录,主要参考了http://canimod.com/guides/creating-a-smapi-mod中的内容.也推荐大家看看. *这些是我的开发 ...
- Stardew Valley(星露谷物语)Mod开发之路 写在前面
之前迷上了一款新游戏Stardew Valley,这几天发现游戏为插件开发提供了SMAPI编程接口,玩家可以方便的自定义游戏内容(瞬间感觉因缺思厅,额..),其实这几年的游戏许多都有mod机制,商家机 ...
随机推荐
- June 11th 2017 Week 24th Sunday
I hope I can find the one who is afraid of losing me. 我希望找到一个担心失去我的人. When I was young, sometimes I ...
- leetcode 322零钱兑换
You are given coins of different denominations and a total amount of money amount. Write a function ...
- windows网络模型之重叠IO的使用
大部分内容转载自https://blog.csdn.net/piggyxp/article/details/114883 目录: 1. 重叠模型的优点 2. 重叠模型的基本原理 3. 关于重叠模型的基 ...
- gluon 实现线性回归
from mxnet import autograd, nd num_inputs = 2 num_examples = 1000 true_w = [2,-3.4] true_b = 4.2 fea ...
- 在Spring整合aspectj实现aop的两种方式
-----------------------------基于XML配置方案目标对象接口1 public interface IUserService { public void add(); pub ...
- 【题解】洛谷P1445 [Violet]樱花 (推导+约数和)
洛谷P1445:https://www.luogu.org/problemnew/show/P1445 推导过程 1/x+1/y=1/n! 设y=n!+k(k∈N∗) 1/x+1/(n!+k)=1 ...
- Spring MVC之@RequestBody, @ResponseBody 详解(转)
简介: @RequestBody 作用: i) 该注解用于读取Request请求的body部分数据,使用系统默认配置的HttpMessageConverter进行解析,然后把相应的数据绑定到要返回的对 ...
- JavaEE权限管理系统的搭建(四)--------使用拦截器实现登录认证和apache shiro密码加密
RBAC 基于角色的权限访问控制(Role-Based Access Control)在RBAC中,权限与角色相关联,用户通过成为适当角色的成员而得到这些角色的权限.这就极大地简化了权限的管理.在一个 ...
- linux简介及虚拟机安装
1.简介 计算机组成
- Java数据结构——二叉树 增加、删除、查询
//二叉树系统 public class BinarySystem { public static void main(String[] args) { BinaryDomain root = nul ...