zoukankan
html css js c++ java
HDU2254 奥运 矩阵应用
//最原始的矩阵应用,不解释 #include "Mat.h" #include <iostream> #include<map> #include<string> using namespace std; map<string, int> M; Mat mat, temp1, temp2; int main() { int n, cnt, k, t1, t2, ans, a1, a2; string p1, p2, v1, v2; mod = 2008; while(cin>>n) { mat.clear(); M.clear(); cnt = 1; while(n--) { cin>>p1>>p2; if(M[p1] == 0) M[p1] = cnt++; if(M[p2] == 0) M[p2] = cnt++; mat.s[M[p1]][M[p2]]++; } mat.sizei = cnt; mat.sizej = cnt; cin>>k; while(k--) { cin>>v1>>v2>>t1>>t2; if(M[v1]==0||M[v2]==0||(t1==0&&t2==0)) { cout<<0<<endl; continue; } if(t1>t2) swap(t1, t2); temp1 = mat;temp2 = mat; temp1.solve(t2);a1 = temp1.s[M[v1]][M[v2]]; if(t1 <= 1) a2 = 0; else { temp2.solve(t1-1); a2 = temp2.s[M[v1]][M[v2]]; } ans = (a1 - a2 + mod ) % mod; cout<<ans<<endl; } } return 0; }
查看全文
相关阅读:
uniGUI中Cookies使用中文汉字的方法(使用EncodeString函数编码)
Delphi中accesss实现树形结构查询系统(一次性生成比较方便)
delphi的万能数据库操作
Delphi汉字简繁体转换代码(分为D7和D2010版本)
“千千静听”滚动标题栏,非常简单!(时间器控制窗口标题栏文字,然后赋值给Application.Title)
js 创建对象
SkyWalking+SkyApm-dotnet分布式链路追踪系统
可靠的连接池
调整数组顺序使奇数位于偶数前面
三种「高可用」架构
原文地址:https://www.cnblogs.com/windmissing/p/2559895.html
最新文章
7-14 电话聊天狂人(25 分)
Linux下几种RTP协议实现的比较和JRTPLIB编程讲解
使用librtmp进行H264与AAC直播
简述RTMPDump与编译移植
linux 编译安装TRMPdump(libRTMP)
跨平台的EVENT事件 windows linux
条件变量(Condition Variable)详解
nginx 中location和root,你确定真的明白他们关系?
用实例分析H264 RTP payload
H264(NAL简介与I帧判断)
热门文章
H264的RTP负载打包的数据包格式,分组,分片
Optional int parameter 'pId' is present but cannot be translated into a null value due to being declared as a primitive type.
cannot be translated into a null value due to being declared as a primitive type. Consid
SpringBoot传递单一参数时@RequestParam和@RequestBody的区
@ApiImplicitParams、ApiImplicitParam的使用
spring boot Swagger2(version=2.7.0) 注解@ApiImplicitParam的属性dataType值为”自定义泛型“应用
精选 Dubbo RPC 面试题,比较全面,含答案
UncategorizedSQLException异常处理办法
2018 最新 spring boot 整合 swagger2 (swagger2 版本 2.8.0)
springfox-swagger原理解析与使用过程中遇到的坑
Copyright © 2011-2022 走看看