随笔分类 - OJ编程算法练习
摘要:Q490: Rotating Sentences在這個問題中你必須將數列文字往順時針方向旋轉90度。也就是說將原本由左到右,由上到下的句子輸出成由上到下,由右到左。Input and Output輸入最多不會超過100列,每列最多不會超過100個字元。 合法的字元包括:換行,空白,所有的標點符號,數字,以及大小寫字母。(注意:Tabs並不算是合法字元。)最後一列輸入必須垂直輸出在最左邊一行,輸入的第一列必須垂直輸出在最右邊一行。請參考sample intput/output。Sample InputRene Decartes once said,"I thin...
阅读全文
摘要:Kindergarten Counting GameEverybody sit down in a circle. Ok. Listen to me carefully.``Woooooo, you scwewy wabbit!''Now, could someone tell me how many words I just said?Input and OutputInput to your program will consist of a series of lines, each line containing multiple words (at least one
阅读全文
摘要:在网上看到的一个比较好的The 3n+1 problem,通过中间变量来保存结果集,较少了运算数量 1 #include <iostream> 2 3 #include <vector> 4 5 6 7 #define SIZE 100000 8 9 10 11 using namespace std;12 13 14 15 int Count(vector<int> &viRec, int iNum)16 17 {18 19 int iTemp=iNum, iResult=0;20 21 22 23 if (viRec[iTemp]!=0) ret
阅读全文

浙公网安备 33010602011771号