毛のはえたようなもの

インターネット的なものをつらつらとかきつらねる。

2007-01-01から1年間の記事一覧

すぐ使えるショートカット

C-g:キャンセル(なんだか変になったらこれを連打)C-y:ヤンク(Emacs内で使えるコピー) C-k:キル(Emacs内で使える切り取り) C-v:一画面文下にスクロール M-v:一画面文上にスクロール C-x C-s:保存 C-x C-w:名前をつけて保存 C-x C-f:ファイルを開く C-x …

Emacs関連

多くなったEmacs関連のお話はここに。ほとんど(id:hayamiz)おすすめの仕様でございます。私が初心者なので、きっと初心者向けの設定です。

インストール-外観・フォント・プリンタ

Thinkpad T42で起動が遅い 解像度が合ってないかららしいですよ。 /etc/usplash.confを使用するディスプレイの解像度に合わせて書き換えたのち、 sudo update-initramfs -u -k all Compiz Berylがこれに統合されたらしいですね.ところで「beryl 7.10」とグー…

インストール-開発環境

Emacs関連 ここにあるよ:http://d.hatena.ne.jp/gomi-box/20071022 Tex関係の設定 以下を参考にしました! http://mynotes.jp/ubuntu/tex あれーC-c t jがきかない。。。 コンパイラセット g++とjavacがないとだめなのでいれますー $ sudo apt-get install …

インストール-ネットワーク関係

PPPoE 無線LANは勝手に空気を読んでつないでくれるUbuntuたん。よい子。(上のバーのところにネットワークの設定のアイコンがあるのでそれをクリックしてパスワードを設定すればよいだけ!) しかしBフレッツ(フレッツ光)はそうはいきません。ケーブルを差し…

問題点

・tex環境でUTF-8がつかえない →「ptetex」を手動インストールすれば何とかなるようだ。

インストール-画像処理

AVIなどの動画を再生する 普通、インストール済みのTotemでは再生できないので別のものをインストールします。 $ sudo apt-get install totem-xine Dia プログラムのフローチャートを作成するためのソフト $ sudo apt-get install dia Inkscape イラストレー…

Ubuntu7.10インストールログ

7.06からアップデートしようとしたのですが、どこかでカーネルを壊したらしい私。リカバリーモードでは立ち上がるのにGUIはだめ。うーん。Xとか壊したかしらん。 いずれにせよヾ(・∀・)ノシ オワタと言うわけで7.10クリーンインストールです。前回のインストール…

ネットワークプログラミング1

socketを使おう!の巻。説明は面倒くさいのでしないというか、私もよくわかってない(o^▽^o) #include <stdio.h> #include <sys/socket.h> #include <netinet/in.h> #include <netdb.h> #define PORT 5555 void err_check(int res, char function_name[]); int main(int argc , char* argv[]){ int new_socke</netdb.h></netinet/in.h></sys/socket.h></stdio.h>…

範囲に収まる数字の数(Pythonの場合)

#! /user/local/bin/python num = [] chohuku =0 for line in open ('../data_d.txt','r'): if line == 0: break else: num.append(int(line)) width = num.pop(0); num.sort(lambda x, y: y-x) maxTimes =0 for i in range(len(num)-1): target = 0 for j i…

範囲に収まる数字の数(c++の場合)

#include <iostream> #include <vector> #include <algorithm> using namespace std; int main(void){ int width; cin >> width; vector<int> num; int number; while(true){ cin >> number; if(number == 0) break; num.push_back(number); } sort(num.begin(), num.end(),greater<int>()); int i=0</int></int></algorithm></vector></iostream>…

範囲に収まる数字の数(c言語の場合)

#include <stdio.h> #include <math.h> int compare_int(const int *a,const int *b){ return *b- *a; } int main(){ int i = 0; int j = 0; int k = 0; char buf[1000]; int num[1000]; int flag=0; int w; int max=0; int target=0; while(fgets(buf, 1000,stdin) != NULL){</math.h></stdio.h>…

範囲に収まる数字の数(Rubyの場合)

number = Array.new File.open("../data_d.txt","r"){|f| f.each{|line| (line.to_i != 0) && (number << line.to_i) } } width = number.shift number.sort! maxTimes =0 number.size.times{|i| tmpTimes = 0 i.upto(number.size){|j| if (number[j].to_i -…

C/C++/Python/Ruby比較7

ある数字列が与えられたとき、指定された範囲に収まる数字の数を表示。 例えば以下のようなデータが与えられる。 6 //初めの行は幅 3 //データ始まり 56 6 43 39 27 13 62 0 //データの終わりは0で示される

相異なる文の種類の数(Pythonの場合)

#! /user/local/bin/python import string num = [] chohuku =0 for line in open ('../data_c.txt','r'): if line == 0: break else: num.append(line) num.sort(lambda x, y: cmp(string.lower(x), string.lower(y))) for i in range(len(num)-1): if num[…

相異なる文の種類の数(c++の場合)

#include <string> #include <iostream> #include <vector> #include <algorithm> using namespace std; int main(void){ vector<string> line; string oneString; while(getline(cin,oneString) ){ if(oneString == "") break; line.push_back(oneString); } sort(line.begin(), line.end(),greater<string>()); i</string></string></algorithm></vector></iostream></string>…

相異なる文の種類の数(c言語の場合)

#include <stdio.h> #include <math.h> #include <string.h> int cmp(const char *a,const char *b){ return strcmp(b,a); } int main(void){ char buf[1000]; FILE *stream; char string[10001][70]; int i = 0; int j = 0; int chohuku =0; while(fgets(buf, 1000,stdin) != NULL){ st</string.h></math.h></stdio.h>…

相異なる文の種類の数(Rubyの場合)

ary = Array.new File.open("../data_c.txt","r"){|f| f.each{|line| line.chomp! !="" && ary << line } } p (ary|ary).size Rubyみじかっ

C/C++/Python/Ruby比較6

文字列を読み込み、相異なる文の種類の数を表示する。具体的には以下のデータで7と表示されればよい。 Is this the first line? Yes, it is. This is the second. I think that was the third. Is this the first line? No, it is not. But this is not the…

重複する数字を表示(Pythonの場合)

#! /user/local/bin/python // 昇順に並べる def compare_int(a,b): return b - a num=[] // ファイルからの入力 for line in open ('../data_a.txt','r'): if line == 0: break else: num.append(int(line)) // ソート num.sort(compare_int) // 同じものが…

重複する数字を表示(c++の場合)

#include <iostream> #include <algorithm> #include <vector> using namespace std; int main(int argc,char* argv[]){ vector<int> num; int number; // ファイルからの入力 while(true){ cin >> number; if(number == 0){ break; } num.push_back(number); } // ソート sort(num.begin(), nu</int></vector></algorithm></iostream>…

重複する数字を表示(c言語の場合)

#include <stdio.h> #include <math.h> // 昇順に並べる int compare_int(const int *a,const int *b){ return *b- *a; } int main(){ int i = 0; int j = 0; char buf[1000]; int num[1000]; // ファイルからの入力 while(fgets(buf, 1000,stdin) != NULL){ if(atoi(buf) == </math.h></stdio.h>…

重複する数字を表示(Rubyの場合)

number = Array.new File.open("../data_a.txt","r"){|f| f.each{|line| (line.to_i != 0) && (number << line.to_i) } } number.sort! 1.upto(number.size-1){|i| (number[i-1] == number[i]) && (p number[i])}

C/C++/Python/Ruby比較5

読み込んだ数字のうちで重複するものを重複しただけ表示する。具体的には以下のようなデータファイルを読み込む。 35 46 62 45 2 5 35 0 // 入力の終わりは0の入力で判断する

k番目に大きい数(Rubyの場合)

flag = 0 k,n = 0, 0 number = Array.new File.open("../data_d.txt","r"){|f| f.each{|line| if flag == 0 n,k = line.split.collect{|i| i.to_i} flag = 1 elsif flag && number.size < n number << line.to_i end } } p number.sort_by{|i| -i}[k-1]

k番目に大きい数(Pythonの場合)

#! /user/local/bin/python def compare_int(a,b): return b - a flag=0 number=[0] for line in open ('../data_d.txt','r'): if flag==0: line.split(" ") n = int(line[0]) k= int(line[2]) flag = 1 else: if int(line)!=0: number.append(int(line)) nu…

k番目に大きい数(c++の場合)

#include <iostream> using namespace std; int compare_int(const int *a,const int *b){ return *b - *a; } int main(int argc,char* argv[]){ int num[1000]; int n, k, x; int i=0; cin >> n; cin >> k; while(cin >> num[i]){ i++; } qsort(num,n,sizeof(int),(in</iostream>…

k番目に大きい数(cの場合)

#include <stdio.h> #include <string.h> int compare_int(const int *a,const int *b){ return *b- *a; } int main(){ int num[1000]; char string[1000]; int n ,k ,x; int i=0; fgets(string, 1000,stdin); sscanf(string,"%d %d",&n,&k); while(fgets(string, 1000,stdin) !</string.h></stdio.h>…

C/C++/Python/Ruby比較4

ファイルから読み取ったn個の数のうち、k番目に大きい数を表示せよ。ただし、ファイルの内容は以下のようなものとする。 5 3 // 「n k」ということ 1 300 200 4 55 0 //最後は0

右側折り返し(Rubyの場合)

maxlength = 72 File.open("../data_c.txt","r"){|f| f.each{|line| line.chomp! (line.size/maxlength).times{|i| line[maxlength*(i+1)+i,0] = "\n" } print line+"\n" } }