【Codeforces】976B Lara Croft and the New Game
【题目大意】
给你一个n行m列的矩阵,先向下移动到第m层,然后向右移到头,向上走一格,向左移到头,再向上一格,向右到头(一直到(1,2)结束)。给你n,m,k(移动步数),问你最后的位置。
【题解】
水题,分类讨论一下就可以了。
【代码如下】
#include<cstdio>
#include<iostream>
#define LL long long
using namespace std;
LL n,m,k;
int main(){
// freopen("B.in","r",stdin);
// freopen("B.out","w",stdout);
cin>>n>>m>>k;
if(k<n) cout<<k+1<<" "<<1<<endl;
else{
k-=n;LL t=k/(m-1),b=k%(m-1);
if(t&1) cout<<n-t<<" "<<m-b<<endl;
else cout<<n-t<<" "<<b+2<<endl;
}
return 0;
}