#include <stdio.h> #include <string.h> #include <unistd.h> char bf[2600000]; void setch(int n, char ch){ ch-=96; int a1=n/8; int a2=n%8; bf[a1+a2*26]=ch; } char getch(int n){ int a1=n/8; int a2=n%8; return bf[a1+a2*26]+96; } int main(){ char c; int l=0,i,a,p; while((c = getchar())!='\n'); while((c = getchar())!='\n'){ setch(l,c); l++; } a=l/2-1; if(l%2==1)p=2; else p=1; for (i=a;i>=0;i--){ if(getch(i)!= getch(a+p)){ printf("NIE\n"); return 0; } p++; } printf("TAK\n"); return 0; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | #include <stdio.h> #include <string.h> #include <unistd.h> char bf[2600000]; void setch(int n, char ch){ ch-=96; int a1=n/8; int a2=n%8; bf[a1+a2*26]=ch; } char getch(int n){ int a1=n/8; int a2=n%8; return bf[a1+a2*26]+96; } int main(){ char c; int l=0,i,a,p; while((c = getchar())!='\n'); while((c = getchar())!='\n'){ setch(l,c); l++; } a=l/2-1; if(l%2==1)p=2; else p=1; for (i=a;i>=0;i--){ if(getch(i)!= getch(a+p)){ printf("NIE\n"); return 0; } p++; } printf("TAK\n"); return 0; } |