Codeforces Round #710 (Div. 3) Editorial 1506A - Strange Table
题目链接 https://codeforces.com/contest/1506/problem/A
原题
1506A - Strange Table

5
1 1 1
2 2 3
3 5 11
100 100 7312
1000000 1000000 1000000000000
1
2
9
1174
1000000000000
题解
先竖列竖列地排数字, 找到x所在的位置s1;
再横行横行地排, 找到s1位置的值并输出
-----> 
(n为总行数, m为总列数, x为要找的数)
结果 = (行数-1)*m+第几列
求行: 要找到这个数的上一行, 这样用取余(x-1) % n, 比如
10, 我们要得到的是(行数-1) = 0
11, 我们要得到的是(行数-1) = 1
12, 我们要得到的是(行数-1) = 2
求列: 用除法(x-1) / n+1, 看下上面的图应该就会了
代码
#include <iostream> using namespace std;
typedef long long ll;
int main()
{
int t;
cin >> t;
while(t --)
{
ll n ,m,x;
scanf("%lld%lld%lld", &n, &m, &x); ll l = (x-1) / n+1;
ll r = (x-1) % n; cout << r*m+l << endl;
}
return 0;
}
Codeforces Round #710 (Div. 3) Editorial 1506A - Strange Table的更多相关文章
- Codeforces Round #590 (Div. 3) Editorial
Codeforces Round #590 (Div. 3) Editorial 题目链接 官方题解 不要因为走得太远,就忘记为什么出发! Problem A 题目大意:商店有n件商品,每件商品有不同 ...
- 水题 Codeforces Round #308 (Div. 2) A. Vanya and Table
题目传送门 /* 水题:读懂题目就能做 */ #include <cstdio> #include <iostream> #include <algorithm> ...
- Codeforces Round #747 (Div. 2) Editorial
Codeforces Round #747 (Div. 2) A. Consecutive Sum Riddle 思路分析: 一开始想起了那个公式\(l + (l + 1) + - + (r − 1) ...
- Codeforces Round #425 (Div. 2) Problem C Strange Radiation (Codeforces 832C) - 二分答案 - 数论
n people are standing on a coordinate axis in points with positive integer coordinates strictly less ...
- Codeforces Round #430 (Div. 2) Vitya and Strange Lesson
D.Vitya and Strange Lesson(字典树) 题意: 给一个长度为\(n\)的非负整数序列,\(m\)次操作,每次先全局异或\(x\),再查询\(mex\) \(1<=n< ...
- Codeforces Round #544 (Div. 3) Editorial C. Balanced Team
http://codeforces.com/contest/1133/problem/Ctime limit per test 2 secondsmemory limit per test 256 m ...
- Codeforces Round #453 ( Div. 2) Editorial ABCD
A. Visiting a Friend time limit per test 1 second memory limit per test 256 megabytes input standard ...
- Codeforces Round #448(Div.2) Editorial ABC
被B的0的情况从头卡到尾.导致没看C,心情炸裂又掉分了. A. Pizza Separation time limit per test 1 second memory limit per test ...
- Codeforces Round #710 (Div. 3)
emmm,就ac了3题 A题转换推下公式. tB题模拟,在第一个与最后一个变x后,直接i下标+k,判断当前下标前一个befor与最后一个last距离是否>k,是的话在当前下标往前找*字符然后改为 ...
随机推荐
- ssm配置推荐
1.JDK 1.8 2.Mysql 5.7 3.Maven 3.6.1
- Blazor 002 : 一种开历史倒车的UI描述语言 -- Razor
Razor是一门相当怪异丑陋的标记语言,但在实际使用中却十分高效灵活.本文主要介绍了Razor是什么,以及Razor引擎的一些浅薄的背后机理. 写文章前我本想一口气把Razor的基本语法,以及Blaz ...
- [SPDK/NVMe存储技术分析]010 - 理解SGL
在NVMe over PCIe中,I/O命令支持SGL(Scatter Gather List 分散聚合表)和PRP(Physical Region Page 物理(内存)区域页), 而管理命令只支持 ...
- CTF--这好像不是文件上传
打开题目F12看到一个被注释的跳转. 访问可以知道是一个文件包含 经过测试,该文件禁止了input.data关键字.并禁止了phar://协议. 使用php://filter读取题目源码得到 http ...
- 数据库中间件ShardingSphere-Proxy(一)
1.现实中的问题 我们知道数据库的数据,基本80%的业务是查询,20%的业务涵盖了增删改,经过长期的业务变更和积累数据库的数据到达了一定的数量之后,直接影响的是用户与系统的交互,查询时的速度,插入数据 ...
- 22.1.22 并查集和KMP算法
22.1.22 并查集和KMP算法 1.并查集结构 1)实现: 并查集有多种实现方式,例如向上指的图的方式,数组的方式等等.其根本思想就在于准确记录某个节点的根节点,这个这种记录就能够很快的实现并查集 ...
- 什么是Spring的依赖注入?
依赖注入,是IOC的一个方面,是个通常的概念,它有多种解释.这概念是说你不用创建对象,而只需要描述它如何被创建.你不在代码里直接组装你的组件和服务,但是要在配置文件里描述哪些组件需要哪些服务,之后一个 ...
- Spring工作原理:初识SpringMVC
1.SpringMVC简介 SpringMVC是Spring框架的一个模块.SpringMVC和Spring无需通过中间层进行整合.是一个轻量级的,基于请求响应的MVC框架. 2.1.什么是MVC? ...
- 什么是pandas
- html5系列:form 2.0 新结构
以往的一个form表单,结构比较死板,所有的form元素都必须处在<form>和</form>之间才有效,这会造成一些麻烦,比如说:像bootstrap这种使用<div& ...