|
|
вернуться в форумwhy time limitexeted???? Послано ooo 14 дек 2008 13:53 #include <iostream.h> int main() {const int n=100; char a[101]; int i,b[n]; for(i=0;i<n;i++) cin>>a[i]; for(i=0;i<n;i++) b[i]=a[i]-'a'; if(b[0]<=5) b[0]=b[0]+26; for(i=1;i<=n;i++) while(a[i]<a[i-1]) b[i]=b[i]+26; for(i=1;i<=n;i++) b[i]=b[i]-b[i-1]; b[0]=b[0]-5; for(i=0;i<n;i++) a[i]=(b[i]+'a'); for(i=0;i<n;i++) cout<<a[i]<<endl; return 0;} Re: why time limitexeted???? You have 6 - "for"!!! 1000^6 work over second Edited by author 28.04.2009 01:13 |
|
|