线性代数问卷调查反馈——Find The Determinant III,Takahashi‘s Basics in Education and Learning
文章目录
- Find The Determinant III
- source
- code
- Takahashi's Basics in Education and Learning
- source
- code
Find The Determinant III
source
code
#include <cstdio>
#include <iostream>
using namespace std;
#define maxn 205
#define int long long
int n, mod;
int x[maxn][maxn];signed main() {while( ~ scanf( "%lld %lld", &n, &mod ) ) {for( int i = 1;i <= n;i ++ )for( int j = 1;j <= n;j ++ )scanf( "%lld", &x[i][j] );int ans = 1;for( int i = 1;i <= n;i ++ ) {for( int j = i + 1;j <= n;j ++ )while( x[j][i] ) {//类似于辗转相除 这样就不会有非整数倍数取模情况了 int t = x[i][i] / x[j][i];for( int k = i;k <= n;k ++ ) {x[i][k] = ( x[i][k] - x[j][k] * t ) % mod;swap( x[i][k], x[j][k] );}ans *= -1;}ans = ans * x[i][i] % mod;}printf( "%lld\n", ( ans + mod ) % mod );}return 0;
}
Takahashi’s Basics in Education and Learning
source
code
#include <cstdio>
#include <cstring>
#include <iostream>
using namespace std;
#define int long long
int n, a0, d, mod;struct matrix {int n, m;int c[3][3];matrix(){ n = m = 0, memset( c, 0, sizeof( c ) ); }int * operator [] ( int i ) { return c[i]; }matrix operator * ( matrix t ) const {matrix ans;ans.n = n, ans.m = t.m;for( int i = 0;i < n;i ++ )for( int j = 0;j < t.m;j ++ )for( int k = 0;k < m;k ++ )ans[i][j] = ( ans[i][j] + c[i][k] * t.c[k][j] ) % mod;return ans;}
}g, ret;matrix qkpow( matrix x, int y ) {matrix ans;ans.n = ans.m = x.n;for( int i = 0;i < 3;i ++ )ans[i][i] = 1;while( y ) {if( y & 1 ) ans = ans * x;x = x * x;y >>= 1;}return ans;
}signed main() {scanf( "%lld %lld %lld %lld", &n, &a0, &d, &mod );ret.n = 1, ret.m = g.n = g.m = 3;ret[0][0] = a0 % mod;ret[0][1] = ( a0 + d ) % mod;ret[0][2] = g[1][0] = g[1][1] = g[2][2] = 1;g[2][1] = d % mod;n --;int End = a0 + d * n;for( int i = 0, mi = 10, last = 0;i < 18 && last < n;i ++, mi *= 10 )if( a0 + d < mi ) {int t = min( mi - 1, End );int now = ( t - a0 ) / d;while( a0 + d * ( now + 1 ) < t ) now ++;g[0][0] = mi % mod;ret = ret * qkpow( g, now - last );last = now;}printf( "%lld\n", ret[0][0] ); return 0;
}
线性代数问卷调查反馈——Find The Determinant III,Takahashi‘s Basics in Education and Learning相关推荐
- 线段树/扫描线问卷调查反馈——Rmq Problem / mex(主席树),Boring Queries(二分+st表+主席树),Colorful Squares(扫描线)
文章目录 Rmq Problem / mex Boring Queries Colorful Squares Rmq Problem / mex luogu4137 对aia_iai建权值线段树 再 ...
- 栈/队列/分块问卷调查反馈——Weak in the Middle,Cutting Plants,最小公倍数
文章目录 Weak in the Middle source solution code Cutting Plants source solution code [HNOI2016]最小公倍数 sou ...
- splay/fhq-treap 问卷调查反馈—— [JSOI2008]火星人prefix(splay),Strange Queries(fhq-treap)
文章目录 [JSOI2008]火星人prefix Strange Queries [JSOI2008]火星人prefix BZOJ1014 思路很好想,哈希字符串即可 只是平衡树的码量大 注意因为sp ...
- 容斥问卷调查反馈——Co-prime,Character Encoding,Tree and Constraints,「2017 山东一轮集训 Day7」逆序对
文章目录 Co-prime source solution code Character Encoding source solution code Tree and Constraints sour ...
- (矩阵行列式求模)Find The Determinant III
https://www.spoj.com/problems/DETER3/en/ 题意即为输出矩阵的行列式求模的答案 分类讨论模为不为质数的情况即可,若为质数,可以使用费马小定理:否则利用公式a/b% ...
- 大学排名居然是一家快倒闭的二流杂志搞出来的自救项目?
1983年,濒临停刊的<美国新闻>决定评估全美1800所学院和大学,试图以此带动杂志销量--大学排名就这样开始了.发展到后来,整个社会不仅认同了大学教育是必不可少的这一观念,而且欣然接受了 ...
- 机器学习(Machine Learning)深度学习(Deep Learning)资料(Chapter 2)
机器学习(Machine Learning)&深度学习(Deep Learning)资料(Chapter 2) - tony的专栏 - 博客频道 - CSDN.NET 注:机器学习资料篇目一共 ...
- 机器学习和深度学习资料汇总【02】
<Image Scaling using Deep Convolutional Neural Networks> 介绍:使用卷积神经网络的图像缩放. <Proceedings of ...
- 【深度学习Deep Learning】资料大全
感谢关注天善智能,走好数据之路↑↑↑ 欢迎关注天善智能,我们是专注于商业智能BI,人工智能AI,大数据分析与挖掘领域的垂直社区,学习,问答.求职一站式搞定! 对商业智能BI.大数据分析挖掘.机器学习, ...
最新文章
- linux动态库注册函数,Linux动态库函数的详解
- eclipse中git的使用----EGIT插件
- 决策树构建算法之—C4.5
- swift mvvm_Swift中的MVVM设计模式概述
- UILabel教程 touch 事件
- dapperpoco mysql_DapperPoco -- 基于Dapper的、轻量级的、高性能的、简单的、灵活的ORM框架...
- css_02 | CSS——CSS 选择器详解
- Dynamips--RIP协议分析的详细过程1--前期工作准备
- isis协议_[IS-IS] IS-IS路由协议的基本知识及配置
- python︱六款中文分词模块尝试:jieba、THULAC、SnowNLP、pynlpir、CoreNLP、pyLTP
- java 图片 白边,如何在Java中自动裁剪图像白色边框?
- python中的异常、模块、文件
- 程序员必看电影片单,高分烧脑假期必备!
- 慕课moocpython答案_中国大学慕课moocPython编程基础作业答案
- pyftpdlib 创建ftpserver
- 蒙特卡洛积分 matlab,菜鸟之路——数学建模之蒙特卡罗积分(投点法,平均值法)+牛顿法解方程组MATLAB实现...
- 怎么用java做动态壁纸_开发实时壁纸
- REMOTE HOST IDENTIFICATION HAS CHANGED问题解决
- Selenium-针对alert弹窗无法获取,弹出no such alert的解决方法
- linux网站ip访问量查询,如何统计网站每天PV和IP访问量排行
热门文章
- 每天20分钟,只需一年,一年级学生英语听力达到六年级水平!关键是坚持一点都不难!
- sklearn线性回归详解
- 计算机管理用户和组无法访问,同一工作组无法访问如何解决【详解】
- 三次握手和四次挥手图解_三次握手和四次挥手简单理解
- c语言输入一个数存数组,//从键盘上输入若干整数,并将其存入数组中,并统计输入数据的个...
- camunda流程定义表无数据_[Python04] 学习snakemake,三步轻松搭建生信流程!
- windows server 2003中 如何限制用户修改计算机名,Windows命令行下修改文件访问控制权限 -电脑资料...
- java跨库调用存储_存储库仅在第二个调用数据时发送回ViewModel
- java怎么将前端的数据存到关联的表中_Java程序员最可能被考到的14个面试题
- core java面试题_CoreJava基础面试题