Lovekey
http://acm.hdu.edu.cn/showproblem.php?pid=2100
#include <bits/stdc++.h> using namespace std; int change(int n,int a[]) { int i = 0; while(n) { a[i++] = n%26; n/=26; } return i; } int main() { int n; int i,l; int a[10]; scanf("%d",&n); l=change(n,a); for(i=0;i<n;i++) printf("%c",a[i]+'A'); printf(" "); }
#include <bits/stdc++.h> using namespace std; int main() { //zzz zzy zzx ... zza ...zyz int L,n; int ans[11]; cin>>L>>n; //3 7421(10进制下的) int i=L; n-=1; while(n) { ans[i--]=n%26; n/=26; } for(int i=1; i<=L; i++) { printf("%d ",ans[i]); } for(int i=1;i<=L;i++) { printf("%c",'z'-ans[i]); } printf(" "); return 0; }