#include <stdio.h>
#include <string.h>
int main(){
char input;
int count=0;
while(1){
input = getc(stdin);
if(input==EOF)break;
if(input>=48&&input<=57)count += input-48; //0~9
else if(input=='!'||input=='\n')printf("\n"); //換行
else
while(count>0){ //根據先前累積的總和來決定輸出次數
if(input=='b')printf(" "); //如果是b輸出空白
else printf("%c",input); //輸出原字元
count--;
}
}
}
2014年8月30日星期六
[UVa] 445 - Marvelous Mazes
訂閱:
發佈留言 (Atom)
-
文章出處: http://infbugs.blogspot.tw/2011/12/c_20.html 謝謝沙耶,解答了我長久以來對於 input/output 的疑惑。 C 語言入門 - 在線上批改系統練功 如何練習使用基本語法 自己出個練習題試著寫...
-
因為X205的架構非常獨特,Linux對其硬體的支援度非常弱(據說kernel4.0之後有所改善,這倒還需要研究一番),目前的進度是將Ubuntu系統塞進32Gb的固態碟中,並設定能自動抓取開機磁區,之後可能還要針對WIFI、音效、快捷鍵和讀卡機等週邊設備進行設定。 1...
-
一開始用數學方法推斷得出,設輸入為n k為在n的前一斜線列數,故只要找到 (1+k)*k/2 < n 的最大k值,即可判定 k%2 == 1 => ((2*n)-(k*k)-k)/2 / ((k*k)+(3*k)-(2*n)+4)/2 k%2 ==...
沒有留言:
發佈留言