Lanqiao Cup Year Number String

Insert picture description here
Examine the number conversion, it will be faster by hand, 2019/26=77...17, the lowest bit is Q(17), 77/26=2...25,77 is expressed as BY, and the answer is BYQ.
Answer: BYQ

#include <bits/stdc++.h>
using namespace std;

int main()
{
    
    
    string ans;
    int num=2019;
    while(num){
    
    
        int i=num%26;
        char c=('A'+i-1);
        ans=c+ans;
        num/=26;
    }
    cout<<ans;
    return 0;
}   

Guess you like

Origin blog.csdn.net/Supreme7/article/details/114676220