Codeforces 1220B. Multiplication Table
冷静分析容易发现,我们只要能确定一个数的值,所有值也就可以确定了
确定一个数的值很容易,$a_ia_j=M_{i,j},a_ia_k=M_{i,k},a_ja_k=M_{j,k}$
然后就可以得到 $a_i=\sqrt {M_{i,j}*M_{j,k}/M_{j,k}}$ ,然后这一题就做完了
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
using namespace std;
typedef long long ll;
inline ll read()
{
ll x=,f=; char ch=getchar();
while(ch<''||ch>'') { if(ch=='-') f=-; ch=getchar(); }
while(ch>=''&&ch<='') { x=(x<<)+(x<<)+(ch^); ch=getchar(); }
return x*f;
}
const int N=;
ll n,m[N][N],a[N];
int main()
{
n=read();
for(int i=;i<=n;i++)
for(int j=;j<=n;j++) m[i][j]=read();
a[]=sqrt(1ll*m[][]*m[][]/m[][]);
for(int i=;i<=n;i++) a[i]=m[][i]/a[];
for(int i=;i<=n;i++) printf("%lld ",a[i]); puts("");
return ;
}
Codeforces 1220B. Multiplication Table的更多相关文章
- codeforces D. Multiplication Table
http://codeforces.com/contest/448/problem/D 题意:一个n×m的矩阵,a[i][j]=i*j; 然后把a数组排序,找出第k个数. 思路:1-n×m二分枚举,然 ...
- Codeforces 577A - Multiplication Table
Let's consider a table consisting of n rows and n columns. The cell located at the intersection of i ...
- CodeForces 577A Multiplication Table 质因子数
题目:click here 题意:看hint就懂了 分析:数论小题,在n0.5时间里求n的质因子数 #include <bits/stdc++.h> using namespace std ...
- Codeforces Codeforces Round #319 (Div. 2) A. Multiplication Table 水题
A. Multiplication Table Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/57 ...
- Codeforces Round #256 (Div. 2) D. Multiplication Table(二进制搜索)
转载请注明出处:viewmode=contents" target="_blank">http://blog.csdn.net/u012860063?viewmod ...
- Codeforces Round #586 (Div. 1 + Div. 2) B. Multiplication Table
链接: https://codeforces.com/contest/1220/problem/B 题意: Sasha grew up and went to first grade. To cele ...
- Codeforces Round #256 (Div. 2) D. Multiplication Table 二分法
D. Multiplication Table time limit per test 1 second memory limit per test 256 megabytes input st ...
- Codeforces 448 D. Multiplication Table
二分法判断答案 D. Multiplication Table time limit per test 1 second memory limit per test 256 megabytes inp ...
- Codeforces 448 D. Multiplication Table 二分
题目链接:D. Multiplication Table 题意: 给出N×M的乘法矩阵要你求在这个惩罚矩阵中第k个小的元素(1 ≤ n, m ≤ 5·10^5; 1 ≤ k ≤ n·m). 题解: n ...
随机推荐
- linux环境下写C++操作mysql(一)
/***************** connect.cpp g++ connect.cpp -o connect -I /usr/include/mysql/ -L /usr/lib/mysql/ ...
- 我不熟悉的list
其实在日常中,链表的题目做的比较多,但是使用STL自带链表的还是比较少,所以里面的一些API不大熟悉.这边也简要介绍一些. 基本的一些API 先列举的这些和上面几篇用法几乎一样,所以不再累述. 赋值相 ...
- php curl方法 支持 http https get post cookie
//请求方式curl封装 @author Geyaru QQ 534208139 参数1:访问的URL,参数2:post数据(不填则为GET),参数3:提交的$cookies,参数4:是否返回$coo ...
- kaliXSSbeef的使用
Kali中Beef的安装和使用: 先打开终端输入 apt-get install beef-xss 然后切换到beef的安装目录 cd /usr/share/beef-xss 然后启动beef ./b ...
- TL;DR
英文文章中,偶尔会出现TL;DR 的字符. TL;DR=>Too Long; Don’t Read=>太长了,读不下去=>长话短说 一般用于在文章开头先给出干货.
- C++入门经典-例3.23-使用嵌套循环输出乘法口诀表
1:代码如下: // 3.23.cpp : 定义控制台应用程序的入口点. // #include "stdafx.h" #include <iomanip> #incl ...
- 装win7英文版装系统学习
1:语言变换,下载Vistalizator ,详细的方法点击:方法见.需要安装语言包,语言包地址请点击:语言包.
- vue一些注意事项
1.生命周期钩子的 this 上下文指向调用它的 Vue 实例. 不要在选项属性或回调上使用箭头函数,比如 created: () => console.log(this.a) 或 vm.$wa ...
- Java JDBC 基础
JDBC API 包含以下几个核心部分: 1:JDBC 驱动 2:Connections (连接) 3:Statements (声明) 4:Result Sets (结果集) JDBC: 打开数据库连 ...
- Charles 功能介绍说明和使用教程
https://juejin.im/post/5b8350b96fb9a019d9246c4c http://blog.devtang.com/2015/11/14/charles-introduct ...