HDU1161 Eddy's mistakes,hdu1161eddy

來源:互聯網
上載者:User

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;}
 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.