976 B. Lara Croft and the New Game
You might have heard about the next game in Lara Croft series coming out this year. You also might have watched its trailer. Though you definitely missed the main idea about its plot, so let me lift the veil of secrecy.
Lara is going to explore yet another dangerous dungeon. Game designers decided to use good old 2D environment. The dungeon can be represented as a rectangle matrix of n rows and m columns. Cell (x, y) is the cell in the x-th row in the y-th column. Lara can move between the neighbouring by side cells in all four directions.
Moreover, she has even chosen the path for herself to avoid all the traps. She enters the dungeon in cell (1, 1), that is top left corner of the matrix. Then she goes down all the way to cell (n, 1) — the bottom left corner. Then she starts moving in the snake fashion — all the way to the right, one cell up, then to the left to the cell in 2-nd column, one cell up. She moves until she runs out of non-visited cells. n and m given are such that she always end up in cell (1, 2).
Lara has already moved to a neighbouring cell k times. Can you determine her current position?
The only line contains three integers n, m and k (2 ≤ n, m ≤ 109, n is always even, 0 ≤ k < n·m). Note that k doesn't fit into 32-bit integer type!
Print the cell (the row and the column where the cell is situated) where Lara ends up after she moves k times.
- 4 3 0
- 1 1
- 4 3 11
- 1 2
- 4 3 7
- 3 2
Here is her path on matrix 4 by 3:
找规律
- #include <iostream>
- #include <algorithm>
- #include <cstring>
- #include <cstdio>
- #include <vector>
- #include <queue>
- #include <stack>
- #include <cstdlib>
- #include <iomanip>
- #include <cmath>
- #include <cassert>
- #include <ctime>
- #include <map>
- #include <set>
- using namespace std;
- #pragma comment(linker, "/stck:1024000000,1024000000")
- #define lowbit(x) (x&(-x))
- #define max(x,y) (x>=y?x:y)
- #define min(x,y) (x<=y?x:y)
- #define MAX 100000000000000000
- #define MOD 1000000007
- #define pi acos(-1.0)
- #define ei exp(1)
- #define PI 3.1415926535897932384626433832
- #define ios() ios::sync_with_stdio(true)
- #define INF 0x3f3f3f3f
- #define mem(a) ((a,0,sizeof(a)))
- typedef long long ll;
- ll n,m,k;
- int main()
- {
- scanf("%lld%lld%lld",&n,&m,&k);
- if(k<=(n-)) printf("%lld 1\n",+k);
- else
- {
- k-=n-;
- ll ans=k/(m-);
- ll pos=k%(m-);
- if(pos==) printf("%lld %lld\n",n-ans+,ans&?m:);
- else printf("%lld %lld\n",n-ans,ans&?m+-pos:+pos);
- }
- return ;
- }
976 B. Lara Croft and the New Game的更多相关文章
- 【ZOJ2276】Lara Croft(bfs)
BUPT2017 wintertraining(16) #4 D ZOJ - 2276 题意 n个数字绕成环,有两个指示数字的方块,每次可以顺时针或逆时针移动其中一个,步数是它当前位置的数字a[i], ...
- 五、Pandas玩转数据
Series的简单运算 import numpy as np import pandas as pd s1=pd.Series([1,2,3],index=['A','B','C']) print(s ...
- PHP操作MongoDB学习(转)
1 mongodb启动时,设置启动项 C:\>mongodb\bin\mongod --config C:\mongodb.conf 其中mongodb.conf为: dbpath = ...
- UVa 10361 Automatic Poetry
Automatic Poetry Input: standard input Output: standard output Time Limit: 2 seconds Memory Limit: 3 ...
- UVA10361 - Automatic Poetry
“Oh God”, Lara Croft exclaims, “it’s one of these dumb riddles again!” In Tomb Raider XIV, Lara is, ...
- Tomb Raider
Lara Croft, the fiercely independent daughter of a missing adventurer, must push herself beyond her ...
- ARTIFICIAL INTELLIGENCE FOR GAMES (Ian Millington / John Funge 著)
相关网站:http://www.ai4g.com PART I AI AND GAMESCHAPTER1 INTRODUCTIONCHAPTER2 GAME AIPART II TECHNIQUESC ...
- ACM/ICPC 2018亚洲区预选赛北京赛站网络赛-B:Tomb Raider(二进制枚举)
时间限制:1000ms 单点时限:1000ms 内存限制:256MB 描述 Lara Croft, the fiercely independent daughter of a missing adv ...
- hihocoder 1829 - 压缩字符串 - [状压+暴力枚举][2018ICPC北京网络预赛B题]
题目链接:https://hihocoder.com/problemset/problem/1829 时间限制:1000ms 单点时限:1000ms 内存限制:256MB 描述 Lara Croft, ...
随机推荐
- 3.QT计算机实战
mainwindow.h #ifndef MAINWINDOW_H #define MAINWINDOW_H #include <QMainWindow> namespace Ui { c ...
- github上下载开源项目
1.首先获取到设置信息 2.找到克隆的路径(本步骤不包含下载.zip的方法) 3.打开 Git Shell ->输入: cd ../../ ->输入: cd 想要安装的路径 ->输 ...
- jq弹窗(获取页面宽高,滚轮高度,始终居中)
jq写一个弹窗,效果如上图所示, 点击按钮弹窗弹出,右上角关闭. 弹窗始终显示在页面中间,无论放大缩小窗口,滚轮滚动. 代码如下: html: <br><br><br&g ...
- 优动漫PAINT基础系列之存储格式说明
本篇经验带大家了解优动漫PAINT可以存储成哪些格式! 最近有收到试用优动漫PAINT个人版试用版的小伙伴提问,优动漫PAINT可以导出什么格式文件呢?今天就这一问题做一下解答〜 优动漫PAINT[试 ...
- servlet中Cookie的编码问题
a.什么是Cookie的编码问题? Cookie只能存放合法的ascii字符,如果是非asicc字符(比如中文), 需要转换成合法的ascii字符的形式. b.如何处理? ...
- vue路由跳转传参
this.$router.push({ path: '/message/result_notice', query: { id: id } }) // let type = this.$route.n ...
- web移动端-弹性盒模型
(父元素加) : /*新版弹性盒模型*/ /* display: flex; */ /*设置主轴方向为水平方向*/ /* flex-direction: row; */ /*设置主轴方向为垂直方向*/ ...
- Redis散杂记
Redis是一款很火的KV模式的内存数据库,与众不同的特点: 1.数据存储在内存 内存的读取速度仅次于CPU的寄存器.各等级缓存,“英雄”自动敏捷属性,特点就是快.高效.因此不需要类似存储磁盘的数据库 ...
- 别了WindowsXP
生命中有太多的迎来送往,今日全世界都在告别它. 虽然自己已经在很久之前没有用XP系统了.告别它不如在一定意义上告别自己的一段时光... 2001年个人第一台电脑...初次安装XP,两张光盘一张安装盘一 ...
- MYSQL锁表问题的解决方法
本文实例讲述了MYSQL锁表问题的解决方法.分享给大家供大家参考,具体如下: 很多时候!一不小心就锁表!这里讲解决锁表终极方法! 案例一 mysql>show processlist; 参看sq ...