HDU1161 Eddy's mistakes,hdu1161eddy
Eddy's mistakesTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 7588 Accepted Submission(s): 4274
Problem DescriptionEddy usually writes articles ,but he likes mixing the English letter uses, for example "computer science" is written frequently "coMpUtEr scIeNce" by him, this mistakes lets Eddy's English teacher be extremely discontentment.Now please you to write a procedure to be able in the Bob article English letter to turn completely the small letter.
InputThe input contains several test cases.each line consists a test case,Expressed Eddy writes in an article , by letter, blank space,numeral as well as each kind of punctuation
composition, the writing length does not surpass 1000 characters.
OutputFor each test case, you should output an only line, after namely the result of transforms the lowercase letter.
Sample Input
weLcOmE tO HDOj Acm 2005!
Sample Output
welcome to hdoj acm 2005!
Authoreddy 接著水。。。
#include <stdio.h>int main(){ char ch; while(scanf("%c", &ch) != EOF){ if(ch >= 'A' && ch <= 'Z') ch = ch - 'A' + 'a'; putchar(ch); } return 0;}
杭電acm1161題為何是Presentation Error??教大牛,
分給我吧
#include<stdio.h>
main()
{
int i,n;
char ch[2000];
while(gets(ch)){
for(i=0;ch[i];i++)
if(ch[i]>='A'&&ch[i]<='Z')
ch[i]=ch[i]+32;
for(i=0;ch[i];i++)
printf("%c",ch[i]);
printf("\n");
}
}
Eddy's research I acm
for(;;)這裡,你看看i=4的時候會怎麼樣,無限迴圈了。。
我改了一點的代碼:
#include <stdio.h>#include <math.h>#define MAX 65540int a[MAX]={0};int main(){int n,val;int i,j,first;while(scanf("%d",&n)!=EOF) {first=0;for(i=2;i<sqrt(MAX)+1;i++){ for(j=2;j<MAX/i;j++) { a[i*j]=1; }}val=n;for(i=2;i<=MAX;i++) {//for(;;){ if(!a[i]) { while(val%i==0)//改個while就好 { if(first) printf("*"); else first=1; printf("%d",i); val/=i; } } } if(i>val) break;}printf("\n");}return 0;}