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

歡迎訪問 生活随笔!

生活随笔

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

编程问答

完美世界第二题:模拟读数字

發布時間:2025/6/15 编程问答 25 豆豆
生活随笔 收集整理的這篇文章主要介紹了 完美世界第二题:模拟读数字 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

測試用例:

102:yibailinger

11:shiyi

1:yi

111:yibaiyishiyi

1 #include <iostream> 2 #include <vector> 3 using namespace std; 4 /************************************************************************/ 5 /* 模擬讀數字 */ 6 /************************************************************************/ 7 void readNumber(const int &number) 8 { 9 string result=""; 10 vector<string> match(10); 11 match[0] = "ling";match[1] = "yi";match[2] = "er";match[3] = "san"; 12 match[4] = "si";match[5] = "wu";match[6] = "liu";match[7] = "qi"; 13 match[8] = "ba";match[9] = "jiu"; 14 int baiwei = number/100; 15 int shiwei = number%100/10; 16 int gewei = number%10; 17 if (baiwei != 0) 18 { 19 result = match[baiwei]; 20 result+="bai"; 21 if (shiwei != 0) 22 { 23 result+=match[shiwei]; 24 result+="shi"; 25 } 26 else 27 result+=match[shiwei]; 28 if (gewei != 0) 29 result+=match[gewei]; 30 } 31 else 32 { 33 if (shiwei != 0) 34 { 35 if(shiwei != 1) 36 result = match[shiwei]; 37 result+="shi"; 38 } 39 if (gewei != 0) 40 result+=match[gewei]; 41 } 42 for (int i=0;i<result.size();i++) 43 cout<<result[i]; 44 cout<<endl; 45 } 46 int main() 47 { 48 int number; 49 while(cin>>number) 50 readNumber(number); 51 system("pause"); 52 return 0; 53 }

?

轉載于:https://www.cnblogs.com/keleshaoye/p/5432983.html

總結

以上是生活随笔為你收集整理的完美世界第二题:模拟读数字的全部內容,希望文章能夠幫你解決所遇到的問題。

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