效率差的不算大............
程序代码:
#include<stdio.h>
#include<string.h>
int main(void)
{
int x[520000],i,len;
gets((char *)x); len=(strlen((char *)x)>>2)+1;
for(i=0;i<len;++i)
{
x[i]^=0x20202020;
}
puts((char *)x);
return 0;
}
Name: "S.K" Problem ID "3"
Submit Time: 2008/5/30-22:28
G++: Compile OK
Test 1: Accepted Time = 0 ms
Test 2: Accepted Time = 141 ms
Test 3: Accepted Time = 121 ms
────────────────
Problem ID 3
Test Result Accepted
Total Time 262 ms
Total Memory 2064 Kb
Code Length 249 Bytes
程序代码:
#include<stdio.h>
#include<string.h>
int main()
{
int i,len;
char ch[2000001];
gets(ch);
len=strlen(ch);
for(i=0;i<len;i++)
{
if(ch[i]>='a')
ch[i]-=32;
else
ch[i]+=32;
}
puts(ch);
return 0;
}
Name: "S.K" Problem ID "3"
Submit Time: 2008/5/30-22:30
G++: Compile OK
Test 1: Accepted Time = 0 ms
Test 2: Accepted Time = 191 ms
Test 3: Accepted Time = 181 ms
────────────────
Problem ID 3
Test Result Accepted
Total Time 372 ms
Total Memory 1984 Kb
Code Length 290 Bytes
程序代码:
#include<stdio.h>
#include<string.h>
int main(void)
{
char x[2000001]; int i,len;
gets(x); len=strlen(x);
for(i=0;i<len;++i)
{
x[i]^=0x20;
}
puts(x);
return 0;
}
Name: "S.K" Problem ID "3"
Submit Time: 2008/5/30-22:31
G++: Compile OK
Test 1: Accepted Time = 0 ms
Test 2: Accepted Time = 131 ms
Test 3: Accepted Time = 161 ms
────────────────
Problem ID 3
Test Result Accepted
Total Time 292 ms
Total Memory 1984 Kb
Code Length 221 Bytes