日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

杭电oj 2719

發布時間:2023/12/18 编程问答 27 豆豆
生活随笔 收集整理的這篇文章主要介紹了 杭电oj 2719 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

?

  Tips:本程序沒有什么難度,只要按照邏輯進行替換即可,需要注意的是,由于輸入串中含有空格符號,所以不能使用scanf("%s",ch);來讀取一串,可以使用gets()函數讀取一行字符。

1 #include<stdio.h> 2 #include<string.h> 3 int main() 4 { 5 char ch[80]; 6 while(gets(ch))//不能使用sacnf("%s,ch),因為遇見空格就會結束讀入 7 { 8 if(*ch == '#') 9 { 10 return 0; 11 } 12 char temp[240]; 13 int j=0; 14 for(int i=0; i<strlen(ch);i++) 15 { 16 if(ch[i] == ' ') 17 { 18 temp[j++] = '%'; 19 temp[j++] = '2'; 20 temp[j++] = '0'; 21 }else if(ch[i] == '!') 22 { 23 temp[j++] = '%'; 24 temp[j++] = '2'; 25 temp[j++] = '1'; 26 }else if(ch[i] == '$') 27 { 28 temp[j++] = '%'; 29 temp[j++] = '2'; 30 temp[j++] = '4'; 31 }else if(ch[i] == '%') 32 { 33 temp[j++] = '%'; 34 temp[j++] = '2'; 35 temp[j++] = '5'; 36 }else if(ch[i] == '(') 37 { 38 temp[j++] = '%'; 39 temp[j++] = '2'; 40 temp[j++] = '8'; 41 }else if(ch[i] == ')') 42 { 43 temp[j++] = '%'; 44 temp[j++] = '2'; 45 temp[j++] = '9'; 46 }else if(ch[i] == '*') 47 { 48 temp[j++] = '%'; 49 temp[j++] = '2'; 50 temp[j++] = 'a'; 51 }else 52 { 53 temp[j++] = ch[i]; 54 } 55 56 } 57 58 int i=0; 59 while(i<j) 60 { 61 printf("%c",temp[i]); 62 i++; 63 } 64 65 printf("\n"); 66 } 67 return 0; 68 }

?

轉載于:https://www.cnblogs.com/wujiyang/p/4534048.html

總結

以上是生活随笔為你收集整理的杭电oj 2719的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。