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; }
查看全文
相关阅读:
20位活跃在Github上的国内技术大牛
ubuntu下安装ros出现“无法下载-package.ros.org中某个包-校验和不符”的解决方法
从ROS bag文件中提取图像
计算机视觉、机器学习相关领域论文和源代码大集合
使用XV-11激光雷达做hector_slam
机器人操作系统(ROS)教程22:ROS的3D可视化工具—rviz
ROS探索总结(三)——ROS新手教程
bootstrap文件上传C#实现
.net分流抢票助手
谷歌浏览器整个网页截图方法
原文地址:https://www.cnblogs.com/windmissing/p/2559895.html
最新文章
字符串拼接工具
读取SQLServer数据库存储过程列表及参数信息
Json转C#Model实体 JsonCSharpClassGenerator
IIS HTTP重定向到HTTPS
ILSpy .NET反编译工具下载地址
Discuz!NT3.0数据字典
IIS URLReWrite URL 重写模块 下载地址
金额小写转中文大写类
SVN官方版本下载地址
【Spring Boot】Spring Boot项目设置多个配置文件,并在生产环境中的Tomcat设置对应的配置文件
热门文章
【缓存与性能优化】方法论:如何优化一个Web系统的性能
【Windows、SVN】在Windows服务器下安装SVN,并在客户端能维护代码版本
【从0到1,搭建Spring Boot+RESTful API+Shiro+Mybatis+SQLServer权限系统】06、Mybatis+SQLServer集成
【从0到1,搭建Spring Boot+RESTful API+Shiro+Mybatis+SQLServer权限系统】04、统一处理异常
【从0到1,搭建Spring Boot+RESTful API+Shiro+Mybatis+SQLServer权限系统】03、创建RESTful API,并统一处理返回值
【从0到1,搭建Spring Boot+RESTful API+Shiro+Mybatis+SQLServer权限系统】02、创建新的SpringBoot项目
【从0到1,搭建Spring Boot+RESTful API+Shiro+Mybatis+SQLServer权限系统】01、环境准备
【Java架构:基础技术】一篇文章搞掂:Idea
C++ 中的 new/delete 和 new[]/delete[]
深入浅出K-Means算法
Copyright © 2011-2022 走看看