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 ...
随机推荐
- Nginx配置记录【例2】
B服务器,例: [root@localhost conf.d]# egrep -v "^#|^$" /etc/nginx/nginx.conf user nginx; worker ...
- 揭秘Android Studio项目目录结构
I don't know if this is because of the Gradle Build System (I'd wager it is), but I'll tell you what ...
- Java并发编程的艺术笔记(六)——HashMap、ConcurentHashMap的原理与实现
一.线程不安全的HashMap 多线程环境下,使用HashMap进行put操作会引起死循环(jdk1.7 Entry链表形成环形数据结构),导致CPU利用率接近100%. 结构:数组 table[]+ ...
- vultr云主机充10美元送50美元
目录 注册地址: 如何收费? 停止状态的实例是否收费? 有哪些支付方式? 提供哪些操作系统? 注册地址: https://www.vultr.com/?ref=8199131 如何收费? 按小时计费, ...
- 文件读取及比较&文件信息保存
#include <stdio.h> #include <stdlib.h> //#include <regex.h> char* file_name_1 = &q ...
- leetcode-easy-listnode-141 Linked List Cycle
mycode 98.22% # Definition for singly-linked list. # class ListNode(object): # def __init__(self, x ...
- 写python获取android设备的GPS及姿态信息
在android上,我们可以使用QPython来编写.执行Python脚本.它对很多android 系统函数进行了方便的封装,使用QPython编写功能简单的小程序异常方便. 这个示例是我之前用来读取 ...
- windows触摸板速度调整
Windows 触摸板滚动速度调整: 在注册表中: The magic key is: Computer\HKEY_CURRENT_USER\Software\Microsoft\Wisp\Tou ...
- Android的消息机制之ThreadLocal的工作原理
ThreadLocal 可以把一个对象保存在指定的线程中,对象保存后,只能在指定线程中获取保存的数据,对于其他线程来说则无法获取到数据. 日常开发中 ThreadLocal 使用的地方比较少,但是系统 ...
- 前端深入之css篇丨2020年前,彻底掌握css动画
马上就2020年了,不知道小伙伴们今年学习了css3动画了吗? 说起来css动画是一个很尬的事,一方面因为公司用css动画比较少,另一方面大部分开发者习惯了用JavaScript来做动画,所以就导致了 ...