już nie wiem. chyba się poddaję. co robię nie tak? teoretycznie każdy mój test działa poprawnie. o co więc chodzi?
#include <cstdio>
#include <vector>
#include <cstdlib>
#include <string>
using namespace std;
int main()
{
char uno[256];
unsigned long long int p;
int j=0,pe;
int o=0;
int num[12];
gets(uno);
scanf("%llu",&p);
//printf("%c - uno[0], %llu - p\n",uno[0],p);
while(p+9/10>0)
{
num[o]=p%10;
p-=num[o];
p/=10;
o++;
}
int s;
for (int i=0;i<=(o-1)/2;i++)
{
s=num[i];
num[i]=num[o-1-i];
num[o-1-i]=s;
}
char c;
while((c=getchar())!=EOF)
{
if(c!='\n'){
pe=num[j];
if(uno[0]=='D') {
if(c-pe<65)
{
int wu=c-(c-num[j]);
c='Z'; pe-=wu-num[j]+1;
}
c-=pe;
}
if(uno[0]=='S') {
if(c+pe>90)
{
int wu=c-(c-num[j]);
c='A'; pe-=wu-num[j]+1;;
}
c+=pe;
}
printf("%c",c);
j++;
if(j>=o)
j=0;
}
else if(j>0)
break;
}
//system("PAUSE");
return 0;
}