2014年8月12日星期二

[UVa] 488 - Triangle Wave


#include <stdio.h>
#include <stdlib.h>
int c; /*case*/
int i,j,tmp;
int main(){
   scanf("%d",&c); /*輸入case數*/
   int S[2][c]; /*宣告 case * 2 的矩陣,擺放每個case的Amplitude及Frequency值*/    
   for(i=0;i<c;i++){
      scanf("%d%d", &S[0][i], &S[1][i]);
      while(S[1][i]>0){
    for(j=1 ; j<=S[0][i] ; j++){
    for(tmp=0; tmp<j; tmp++)
    printf("%d",j);
    printf("\n");
    }
    for(j=S[0][i]-1 ; j>0 ; j--){       
    for(tmp=0; tmp<j; tmp++)
    printf("%d",j);
    printf("\n");
    }
    S[1][i]--;
    if(S[1][i]>0)printf("\n");
      }
   if(i<(c-1))printf("\n");
   }
   return 0;
}

2014年8月10日星期日

Setup MinGW (GCC Compiler in Windows)

Download and Install


MinGW Homepage: http://www.mingw.org/

Download MinGW installer: http://sourceforge.net/projects/mingw/files/Installer/

In MinGW Installation Manager window, we can only choose mingw32-gcc-g++ (The GNU C++ Compiler) then Apply Change to setup.

Environment Settings

  1. Right-click on your "My Computer" icon and select "Properties".
  2. Click on the "Advanced" tab, then on the "Environment Variables" button.
  3. You should be presented with a dialog box with two text boxes. The top box shows your user settings. The PATH entry in this box is the one you want to modify. Note that the bottom text box allows you to change the system PATH variable. You should not alter the system path variable in any manner, or you will cause all sorts of problems for you and your computer!
  4. Click on the PATH entry in the TOP box, then click on the "Edit" button
  5. Scroll to the end of the string and at the end add
    ;<installation-directory>\bin
  6. press OK -> OK -> OK and you are done. 

2014年8月9日星期六

[POJ] 3617 - Best Cow Line


#include <stdio.h>
#include <stdlib.h>
int N, cnt = 0, i;
char S[2001];
void solve(){
   int a = 0, b = N-1;
   while(a <= b){
      int left = 0;
      for (i = 0; a+1<=b; i++){
         if(S[a+i] < S[b-i]){
            left = 1;
            break;
         }
         else if(S[a+i] > S[b-i]){
            left = 0;
            break;
         }
      }
      if(left)putchar(S[a++]);
      else putchar(S[b--]);
      cnt++;
      if(cnt %80 == 0)putchar('\n');
   }
   putchar('\n');
}
int main(){
   while(scanf("%d",&N)!= EOF){
      for(i=0; i<N; i++)
      {
         getchar(); //避免前面的scanf遺留的換行(\n)讀入
         scanf("%c", &S[i]);
      }
     
      solve();
   }
   return 0;
}

2014年8月7日星期四

新的開始

學生時期接觸的多半是電機方面的知識,多半是自動控制居多,所撰寫的程式也僅包含了影像傳輸、人機介面和機械控制的部分。

在網路上找到幾個網站,再配上幾本書籍,希望在鑽研許久之後,可以提升自己的程式能力,起碼不要和資訊專業的人相差太多,對未來工作相信也會有所幫助。


§參考資料


§Online Judge


若有增加,再來補齊。

2014年8月1日星期五

How to set up the TrackPoint in Linux in Thinkpad X40


Configuration using xinput

 

If you want to modify changes on the fly, you can do so with xinput (part of the optional xorg-x11-apps rpm on Fedora). Note that these changes are not saved when the xserver is restarted. However, you can add the lines e.g. in your .xsessionrc (depends on your distribution) so they are executed every time X starts.

To query the available options
xinput list-props "TPPS/2 IBM TrackPoint"

More information can be found in the man-pages for evdev
man evdev

To enable vertical scrolling
xinput set-prop "TPPS/2 IBM TrackPoint" "Evdev Wheel Emulation" 1
xinput set-prop "TPPS/2 IBM TrackPoint" "Evdev Wheel Emulation Button" 2
xinput set-prop "TPPS/2 IBM TrackPoint" "Evdev Wheel Emulation Timeout" 200

To enable horizontal scrolling in addition to vertical scrolling
xinput set-prop "TPPS/2 IBM TrackPoint" "Evdev Wheel Emulation Axes" 6 7 4 5

To enable middle button emulation (using left- and right-click simultaneously)
xinput set-prop "TPPS/2 IBM TrackPoint" "Evdev Middle Button Emulation" 1
xinput set-prop "TPPS/2 IBM TrackPoint" "Evdev Middle Button Timeout" 50

文章參考來源:http://www.thinkwiki.org/wiki/How_to_configure_the_TrackPoin