黑龙江大学程序设计竞赛(重现赛)A - Find the Nth Character(思维)

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/sugarbliss/article/details/89526190

题目链接:https://ac.nowcoder.com/acm/contest/877/A

#include<iostream>
using namespace std;
int T,n,x;
int main()
{
    cin >> T;
    while(T--)
    {
        cin >> n;
        x = 1;
        while(n > x)
            n -= x, x++;
        cout << char(97+(n-1)%26) << endl;
    }
    return 0;
}

猜你喜欢

转载自blog.csdn.net/sugarbliss/article/details/89526190