HDOJ 1129 Do the Untwist
字符串
#include <stdio.h>
int main()
{
char s[81];
int i,k,n,d,p,c[81];
while(scanf("%d",&k),k) {
getchar();
gets(s);
for(n = 0;s[n];n++)
c[n] = s[n] == '_'? 0: s[n] == '.'? 27: s[n] - 'a' + 1;
for(i = 0;i < n;i++)
s[(k * i) % n] = (p = (c[i] + i) % 28) == 0? '_': p == 27? '.': p - 1 + 'a';
puts(s);
}
}