<?xml version="1.0" encoding="UTF-8" ?><rdf:RDF 
  xmlns="http://purl.org/rss/1.0/"
  xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" 
  xmlns:dc="http://purl.org/dc/elements/1.1/"
  xml:lang="ja">
  <channel rdf:about="http://www23.atwiki.jp/homework/">
    <title>C/C++の宿題を片付けます@wiki</title>
    <link>http://www23.atwiki.jp/homework/</link>
    <description>C/C++の宿題を片付けます@wiki</description>

    <dc:language>ja</dc:language>
    <dc:date>2010-08-05T23:07:44+09:00</dc:date>

    <items>
      <rdf:Seq>
                <rdf:li rdf:resource="http://www23.atwiki.jp/homework/pages/30.html" />
                <rdf:li rdf:resource="http://www23.atwiki.jp/homework/pages/29.html" />
                <rdf:li rdf:resource="http://www23.atwiki.jp/homework/pages/28.html" />
                <rdf:li rdf:resource="http://www23.atwiki.jp/homework/pages/27.html" />
                <rdf:li rdf:resource="http://www23.atwiki.jp/homework/pages/26.html" />
                <rdf:li rdf:resource="http://www23.atwiki.jp/homework/pages/25.html" />
                <rdf:li rdf:resource="http://www23.atwiki.jp/homework/pages/24.html" />
                <rdf:li rdf:resource="http://www23.atwiki.jp/homework/pages/23.html" />
                <rdf:li rdf:resource="http://www23.atwiki.jp/homework/pages/22.html" />
                <rdf:li rdf:resource="http://www23.atwiki.jp/homework/pages/21.html" />
              </rdf:Seq>
    </items>
	
		
    
  </channel>
    <item rdf:about="http://www23.atwiki.jp/homework/pages/30.html">
    <title>よくある問題/二進数</title>
    <link>http://www23.atwiki.jp/homework/pages/30.html</link>
    <description>
      *二進数
十進数を二進数に変換して出力

C
 #include&lt;stdio.h&gt;
 void BinDisp(int n){
   if(n &gt; 1) BinDisp(n / 2);
   printf(&quot;%d&quot;, n % 2);
 }
 int main(){
   BinDisp(10);
   printf(&quot;\n&quot;);
 }
----    </description>
    <dc:date>2010-08-05T23:07:44+09:00</dc:date>
  </item>
    <item rdf:about="http://www23.atwiki.jp/homework/pages/29.html">
    <title>よくある問題/階乗</title>
    <link>http://www23.atwiki.jp/homework/pages/29.html</link>
    <description>
      *階乗

----
**ループで階乗を求める

C
 #include&lt;stdio.h&gt;
 unsigned int factorial( unsigned int n)
 {
   unsigned int result = 1;
   while(n != 0) result *= n, --n;
   return result
 }
 int main( void )
 {
   int n;
   printf(&quot;nを入力：&quot;);
   scanf(&quot;%d&quot;, &amp;n);
   printf(&quot;%dの階乗は%d\n&quot;, n, factorial(n));
   return 0;
 }
----
**再帰で階乗を求める

C
 #include&lt;stdio.h&gt;
 unsigned int factorial( unsigned int n)
 {
   return n == 0 ? 1 : n * factorial(n-1);
 }
 int main( void )
 {
   int n;
   printf(&quot;nを入力：&quot;);
   scanf(&quot;%d&quot;, &amp;n);
   printf(&quot;%dの階乗は%d\n&quot;, n, factorial(n));
   return 0;
 }    </description>
    <dc:date>2010-08-05T23:04:30+09:00</dc:date>
  </item>
    <item rdf:about="http://www23.atwiki.jp/homework/pages/28.html">
    <title>よくある問題/ソート</title>
    <link>http://www23.atwiki.jp/homework/pages/28.html</link>
    <description>
      *ソート

----
**バブルソート（基本交換法、隣接交換法）
安定な内部ソート。O(n^2)

C
 #include&lt;stdio.h&gt;
 int main(){
   int i, j, temp, ptr[] = {8,4,3,7,6,5,2,1}, n = 8;
 
   /* Bubble sort */
   for(i = 1; i &lt;= n-1; ++i)
     for(j = 0; j &lt; n-i; ++j)
       if(ptr[j] &gt; ptr[j+1]){
         temp = ptr[j];
         ptr[j] = ptr[j+1];
         ptr[j+1] = temp;
       }
 
   for(i = 0; i &lt; n; ++i) printf(&quot;%d &quot;, ptr[i]);
   return 0;
 }
----
**挿入ソート（インサーションソート、基本挿入法）
安定な内部ソート。O(n^2)

C
 #include&lt;stdio.h&gt;
 int main(){
   int i, j, temp, ptr[] = {8,4,3,7,6,5,2,1}, n = 8;
 
   /* Insertion sort */
   for(i=1; i&lt;n; ++i)
     for(j=i; j&gt;0 &amp;&amp; ptr[j-1]&gt;ptr[j]; --j){
         temp = ptr[j];
         ptr[j] = ptr[j-1];
         ptr[j-1] = temp;
     }
 
   for(i = 0; i &lt; n; ++i) printf(&quot;%d &quot;, ptr[i]);
   return 0;
 }
----
**選択ソート（セレクションソート）
内部ソートだが、安定ソートではない。O(n^2)

C
 #include&lt;stdio.h&gt;
 int main(){
   int i, j, min, temp, ptr[] = {8,4,3,7,6,5,2,1}, n = 8;
 
   /* Selection sort *    </description>
    <dc:date>2010-08-05T23:02:19+09:00</dc:date>
  </item>
    <item rdf:about="http://www23.atwiki.jp/homework/pages/27.html">
    <title>よくある問題/素数</title>
    <link>http://www23.atwiki.jp/homework/pages/27.html</link>
    <description>
      *素数
２以上の整数を読み込み素数であるかどうかを判定する文をつくる

C
 #include&lt;stdio.h&gt;
 
 int isPrime( int n )
 {
   int i;
   if( n &lt; 2 ) return 0;
   if( n == 2 ) return 1;
   if( n%2 == 0 ) return 0;
   for( i = 3; i * i &lt;= n; i += 2 ) if( n%i == 0 ) return 0;
   return 1;
 }
 
 int main() {
   int n;
   scanf(&quot;%d&quot;, &amp;n);
   if(isPrime(n)){
     printf(&quot;素数\n&quot;);
   }else{
     printf(&quot;素数ではない\n&quot;);
   }
   return 0;
 }
----    </description>
    <dc:date>2010-12-01T00:38:41+09:00</dc:date>
  </item>
    <item rdf:about="http://www23.atwiki.jp/homework/pages/26.html">
    <title>よくある問題/カレンダー</title>
    <link>http://www23.atwiki.jp/homework/pages/26.html</link>
    <description>
      *カレンダー
月のカレンダーを出力する

C
 #include&lt;stdio.h&gt;
 int main(){
   int days[] = {31,28,31,30,31,30,31,30,31,31,30,31,30,31};
   int y, m, d, i, k;
 
   printf(&quot;y=&quot;);
   scanf(&quot;%d&quot;, &amp;y);
   printf(&quot;m=&quot;);
   scanf(&quot;%d&quot;, &amp;m);
   if(1583&gt;y || y&gt;4000 || 1&gt;m || m&gt;12) return 1;
   printf(&quot;\n%d/%d\n\n&quot;, y, m);
 
   d = days[m-1];
   if(m==2 &amp;&amp; (y%4==0&amp;&amp;y%100!=0||y%400==0)) d++;
 
   if(m==1 || m==2){
     y--;
     m += 12;
   }
   k = (y+(int)(y/4)-(int)(y/100)+(int)(y/400)+(int)((13*m+8)/5)+1) % 7;
 
   printf(&quot;日 月 火 水 木 金 土\n&quot;);
   for(i=0; i&lt;k; i++) printf(&quot;   &quot;);
   for(i=1; i&lt;=d; i++){
     printf(&quot;%2d &quot;, i);
     if(++k%7==0) printf(&quot;\n&quot;);
   }
   printf(&quot;\n&quot;);
   return 0;
 }

C++
 #include&lt;iostream&gt;
 using namespace std;
 int main()
 {
   int days[] = {31,28,31,30,31,30,31,30,31,31,30,31,30,31};
   int y, m, d, i, k;
 
   cout&lt;&lt;&quot;y=&quot;; cin&gt;&gt;y;
   cout&lt;&lt;&quot;m=&quot;; cin&gt;&gt;m;
   if(1582&gt;=y || y&gt;=4000 || 1&gt;m || m&gt;12) return 1;
   cout&lt;&lt;&#039;\n&#039;&lt;&lt;y&lt;&lt;&#039;/&#039;&lt;&lt;m&lt;&lt;&quot;\n\n&quot;;    </description>
    <dc:date>2010-08-05T22:55:08+09:00</dc:date>
  </item>
    <item rdf:about="http://www23.atwiki.jp/homework/pages/25.html">
    <title>よくある問題</title>
    <link>http://www23.atwiki.jp/homework/pages/25.html</link>
    <description>
      * よくある問題
-[[素数&gt;よくある問題/素数]] / [[ソート&gt;よくある問題/ソート]] / [[カレンダー&gt;よくある問題/カレンダー]]
-[[組合せ&gt;よくある問題/組合せ]] / [[階乗&gt;よくある問題/階乗]] / [[平方根&gt;よくある問題/平方根]]
-[[リスト&gt;よくある問題/リスト]] / [[二進数&gt;よくある問題/二進数]]    </description>
    <dc:date>2010-08-05T23:06:51+09:00</dc:date>
  </item>
    <item rdf:about="http://www23.atwiki.jp/homework/pages/24.html">
    <title>2008-07-02/宿題03</title>
    <link>http://www23.atwiki.jp/homework/pages/24.html</link>
    <description>
      出題内容
&amp;memox(cols=70,rows=10,submit=更新&lt;&gt;[1] 課題：日数チェックプログラム\n[2] 内容：西暦と月を入力し、その月の日数を表示するプログラムを作成しなさい。\n　　　　　尚、日数チェックはnisuu_chk（）関数及び、uru_chk（）関数を用いること。\n　　　　　＜nisuu_chk（）関数の仕様＞\n　　　　　西暦と月のデータ（int型）を受取り、その月の日数をint型の値で返す関数\n　　　　　注意：二月の日数は閏年でない時は２８、閏年では２９となる（uru_chk（）　　　　　　　　関数を利用する\n　　　　　ここから、わかりません。\n[3] 環境\n　[3.1] OS： （WindowsXPかVista）\n　[3.2] \n　[3.3] 言語： （C++）\n[4] 期限：9月15日まで\n[5])

ソースコード
&amp;memox(cols=70,rows=15,submit=更新&lt;&gt;#define  CRT_SECURE_NO_DEPRECATE\n#include  &lt;stdio.h&gt;\nint  nisuu_chk（int,int）;\nint uru_chk（int,int）;\nvoid  main（void）\n{\n	int  yy,mm;\n	char  dsp[4]={28,29,30,31};\n	printf（&quot;年（西暦:4桁）を入力して下さい&quot;）;\n	scanf（&quot;%d&quot;,&amp;yy）;\n	printf（&quot;月を入力して下さい&quot;）;\n	scanf（&quot;%d&quot;,&amp;mm）;\n	printf（&quot;%d年%d月は%d日まであります&quot;,yy,mm,nisuu_chk（yy,mm））;\n})

作業にかかる場合、断念する場合などかならず↓で宣言しましょう。
#comment(below)    </description>
    <dc:date>2011-08-02T19:05:33+09:00</dc:date>
  </item>
    <item rdf:about="http://www23.atwiki.jp/homework/pages/23.html">
    <title>最近の宿題</title>
    <link>http://www23.atwiki.jp/homework/pages/23.html</link>
    <description>
      最近の宿題とか・・・
#list_newcreated(7)    </description>
    <dc:date>2008-07-02T13:43:40+09:00</dc:date>
  </item>
    <item rdf:about="http://www23.atwiki.jp/homework/pages/22.html">
    <title>カレンダー</title>
    <link>http://www23.atwiki.jp/homework/pages/22.html</link>
    <description>
      #calendar(option=link)    </description>
    <dc:date>2008-07-02T13:42:54+09:00</dc:date>
  </item>
    <item rdf:about="http://www23.atwiki.jp/homework/pages/21.html">
    <title>2008-07-02/宿題02</title>
    <link>http://www23.atwiki.jp/homework/pages/21.html</link>
    <description>
      出題内容
&amp;memox(cols=70,rows=15,submit=更新&lt;&gt;課題：\n\n行列Aを3x3行列としたとき\nx&#039;（t） = Ax（t）\nの解を求めよ。\n\nまた行列Aはキーボードから入力せよ。\n\nヒント：\nx（t） = e^（At）x（0）　である。\n（状態遷移行列e^（At）はオイラー法で求めよ）)

ソースコード
&amp;memox(cols=70,rows=15,submit=更新&lt;&gt;空き)

作業にかかる場合、断念する場合などかならず↓で宣言しましょう。
#comment(below)    </description>
    <dc:date>2010-07-07T13:40:21+09:00</dc:date>
  </item>
  </rdf:RDF>

