Strange Table | codeforces

Strange Table


from Codeforces Round #710 (Div. 3)
Time limit:2s
Memory limit:256MB

在这里插入图片描述
在这里插入图片描述


ac代码:
#include<iostream>
using namespace std;
long long t,n,m,x,row,col;
int main(){
    
    
    cin>>t;
    while(t--){
    
    
        cin>>n>>m>>x;
        col = x / n + 1;
        row = x % n;
        if(row == 0)
            --col,row = n;
        cout<<(row - 1) * m + col<<"\n";
    }
    return 0;
}

猜你喜欢

转载自blog.csdn.net/qq_45985728/article/details/115256135
今日推荐