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,是的话在当前下标往前找*字符然后改为 ...
随机推荐
- kubernetes集群节点多网卡,calico指定网卡
kubernetes集群节点多网卡,calico指定网卡 1.calico如果有节点是多网卡,所以需要在配置文件中指定内网网卡 spec: containers: - env: - name: DAT ...
- 集合 copy
#集合的创建 # set = set(["barry",1,2]) # print(set) # set1 = {1,2,3} #集合的增 # set1 = {'alex','wu ...
- Ubuntu- 彻底干净卸载MySQL、Apache2、Php的方法
一.卸载删除 mysql 1 sudo apt-get autoremove --purge mysql-server-5.0 2 sudo apt-get remove mysql-server 3 ...
- 【自动化基础】手把手教零基础小白搭建APP的UI自动化环境
前言 帮助零基础小白一步步搭建UI自动化环境,完成Python+Appium+模拟器/真机的UI自动化环境搭建. 环境准备: jdk1.8.0 sdk Node.js appium python Ap ...
- CF1479X Codeforces Round #700
C Continuous City(图的构造) 题目大意:让你构造一个n\le 32的有向无环无重边图,使得从1走到n的所有路径长度在L,R之间,且每种长度的路径只有唯一一条,$L,R\le 1e6$ ...
- nacos底层原理
Nacos 为什么选择NacosNacos 致力于帮助您发现.配置和管理微服务.Nacos 提供了一组简单易用的特性集,帮助您快速实现动态服务发现.服务配置.服务元数据及流量管理. Nacos 帮 ...
- overflow原理?
overflow: hidden能清除块内子元素的浮动影响. 因为该属性进行超出隐藏时需要计算盒子内所有元素的高度, 所以会隐式清除浮动 创建BFC条件(满足一个): float的值不为none: o ...
- Zookeeper 文件系统 ?
Zookeeper 提供一个多层级的节点命名空间(节点称为 znode).与文件系统不 同的是,这些节点都可以设置关联的数据,而文件系统中只有文件节点可以存放 数据而目录节点不行. Zookeeper ...
- kafka consumer代码梳理
kafka consumer是一个单纯的单线程程序,因此相对于producer会更好理解些.阅读consumer代码的关键是理解回调,因为consumer中使用了大量的回调函数.参看kafka中的回调 ...
- 不同版本的 Spring Framework 有哪些主要功能?
Version Feature Spring 2.5 发布于 2007 年.这是第一个支持注解的版本. Spring 3.0 发布于 2009 年.它完全利用了 Java5 中的改进,并为 JEE6 ...