Size: px
Start display at page:

Download ""

Transcription

1

2

3

4

5

6 4

7 5

8 6

9 CHAPTER 1

10 1 1-1 n % i n = 3 m = 10 k = {1, 3, 5 Yes 1, 1, 3, 5 10 n = 3 m = 9 k = {1, 3, 5 No 9 8

11 1-1 #include <cstdio> const int MAX_N = 50; int main() { int n, m, k[max_n]; // scanf("%d %d", &n, &m); for (int i = 0; i < n; i++) { scanf("%d", &k[i]); // m bool f = false; // 4 for (int a = 0; a < n; a++) { for (int b = 0; b < n; b++) { for (int c = 0; c < n; c++) { for (int d = 0; d < n; d++) { if (k[a] + k[b] + k[c] + k[d] == m) { f = true; // if (f) puts("yes"); else puts("no"); return 0; 9

12 1 10

13

14 1 12

15 // int n, m, k[max_n]; void solve() { bool f = false; 13

16 1 for (int a = 0; a < n; a++) { for (int b = 0; b < n; b++) { for (int c = 0; c < n; c++) { for (int d = 0; d < n; d++) { if (k[a] + k[b] + k[c] + k[d] == m) { f = true; if (f) puts("yes"); else puts("no"); 14

17

18 1 #include <cstdio> int main() { int a, b; scanf("%d %d", &a, &b); printf("%d n", a + b); return 0; 16

19 1-4 17

20 1 18

21 1-4 g k 19

22

23 i % i n = 5 a = {2, 3, 4, 5, , 4, 5 n = 4 a = {4, 5, 10, 20 21

24 1 0 < 2 // int n, a[max_n]; void solve() { int ans = 0; // // i < j < k for (int i = 0; i < n; i++) { for (int j = i + 1; j < n; j++) { for (int k = j + 1; k < n; k++) { int len = a[i] + a[j] + a[k]; // int ma = max(a[i], max(a[j], a[k])); // int rest = len - ma; // 2 if (ma < rest) { // ans = max(ans, len); // 22

25 1-6 printf("%d n", ans); i % i L = 10 n = 3 x = {2, 6, 7 min = 4 max = 8 n n n 23

26 1 // int L, n; int x[max_n]; void solve() { // int mint = 0; for (int i = 0; i < n; i++) { mint = max(mint, min(x[i], L - x[i])); // int maxt = 0; for (int i = 0; i < n; i++) { maxt = max(maxt, max(x[i], L - x[i])); printf("%d %d n", mint, maxt); 24

27 1-6 for (int a = 0; a < n; a++) { for (int b = 0; b < n; b++) { for (int c = 0; c < n; c++) { for (int d = 0; d < n; d++) { if (k[a] + k[b] + k[c] + k[d] == m) { f = true; k a+k b+k c+k d =m d k d =m k a k b k c d a b c a b c x x x x 25

28 1 O(n log n) O(n 3 log n) // int n, m, k[max_n]; bool binary_search(int x) { // x k[l], k[l + 1],..., k[r - 1]... int l = 0, r = n; // while (r - l >= 1) { int i = (l + r) / 2; if (k[i] == x) return true; // else if (k[i] < x) l = i + 1; else r = i; // return false; 26

29 1-6 void solve() { // sort(k, k + n); bool f = false; for (int a = 0; a < n; a++) { for (int b = 0; b < n; b++) { for (int c = 0; c < n; c++) { // if (binary_search(m - k[a] - k[b] - k[c])) { f = true; if (f) puts("yes"); else puts("no"); k c+k d=m k a k b c, d c d O(n 2 log n) O(n 2 log n) // int n, m, k[max_n]; // 2 int kk[max_n * MAX_N]; bool binary_search(int x) { 27

30 1 // x kk[l], kk[l + 1],..., kk[r - 1] int l = 0, r = n * n; // while (r - l >= 1) { int i = (l + r) / 2; if (kk[i] == x) return true; // else if (kk[i] < x) l = i + 1; else r = i; // return false; void solve() { // k[c] + k[d] for (int c = 0; c < n; c++) { for (int d = 0; d < n; d++) { kk[c * n + d] = k[c] + k[d]; // sort(kk, kk + n * n); bool f = false; for (int a = 0; a < n; a++) { for (int b = 0; b < n; b++) { // 2 if (binary_search(m - k[a] - k[b])) { f = true; if (f) puts("yes"); else puts("no"); 28

31 CHAPTER 2

32 2 2-1 int fact(int n) { if (n == 0) return 1; return n * fact(n - 1); n n- n- int fib(int n) { if (n <= 1) return n; return fib(n - 1) + fib(n - 2); 30

33 2-1 int memo[max_n + 1]; int fib(int n) { if (n <= 1) return n; if (memo[n]!= 0) return memo[n]; return memo[n] = fib(n - 1) + fib(n - 2); 31

34 2 #include <stack> #include <cstdio> using namespace std; int main() { stack<int> s; // int s.push(1); // { {1 s.push(2); // {1 {1,2 s.push(3); // {1,2 {1,2,3 printf("%d n", s.top()); // 3 s.pop(); // {1,2,3 {1,2 printf("%d n", s.top()); // 2 s.pop(); // {1,2 {1 printf("%d n", s.top()); // 1 s.pop(); // {1 { return 0; 32

35 2-1 #include <queue> #include <cstdio> using namespace std; int main() { queue<int> que; // int que.push(1); // { {1 que.push(2); // {1 {1,2 que.push(3); // {1,2 {1,2,3 printf("%d n", que.front()); // 1 que.pop(); // {1,2,3 {2,3 printf("%d n", que.front()); // 2 que.pop(); // {2,3 {3 printf("%d n", que.front()); // 3 que.pop(); // {3 { return 0; 33

36 2 n % i n=4 a={1,2,4,7 k=13 Yes 13 = n=4 a={1,2,4,7 k=15 No n n 34

37 2-1 // int a[max_n]; int n, k; // i sum i bool dfs(int i, int sum) { // n sum k if (i == n) return sum == k; // a[i] if (dfs(i + 1, sum)) return true; // a[i] if (dfs(i + 1, sum + a[i])) return true; // a[i] k false return false; void solve() { if (dfs(0, 0)) printf("yes n"); else printf("no n"); * *** *W* *** % N=10, M=12 'W' '.' W...WW.. W.W.W...W..W.W...W...W...W. 35

38

39 おすすめ 電子書籍 2 体験型の本書でプログラミングの 第1歩を踏みだそう 豊富なイラストで なぜ? を解消! Javaの第一歩を踏み出そう やさしくはじめるiPhoneアプリ作りの教科書 Swift 3 スッキリわかるJava入門 第2版 は Javaの基礎から初 Xcode 8.2対応 は iphoneアプリを作ってみたい初心 学者には難しいとされるオブジェクト指向まで 膨らむ疑問 者のための入門書です プログラミングが初めての人 苦 にしっかり対応しました Javaプログラミングの なぜ が では実際にサンプルアプリを作りながら学んでいきますが イラストによる解説で 一歩ずつ丁寧に iphoneアプリ作 りの基本と楽しさを学べます イラスト に プログラ よる解説で ミ はじめて ングが の人でも 学べる プログラミング 手意識がある人でも楽しく学んでいけるよう なるべくやさ しく イラストや図をたくさん使って解説しています 本書 わかる解説と約300点の豊富なイラストで 楽しく 詳しく スッキリとマスターできる構成となっています なんとなく Javaを使っているけれど オブジェクト指向の理解には自 信がない 学習の途中で挫折してしまった という方にも おススメです 300もの イ 楽しく ラストで 詳 マスター しく スッキリ と! リは ンプルアプ 作成するサ シンプルで ながら作っていける し 意味を理解 やさしくはじめる iphone アプリ作りの 教科書 Swift 3 Xcode 8.2 対応 マイナビ出版 森巧尚 著者 まつむらまきお イラスト 312 ページ 価格 3,002 円 PDF Swift ios開発 も とりの中に 会話のやり ヒントが の 開発現場で いる て 詰め込まれ スッキリわかる Java 入門 第 2 版 インプレス 中山清喬 国本大悟 著者 658 ページ 価格 2,376 円 PDF Java

40

41

http://book.mynavi.jp/support/pc/5109 / URL 2 Visual C# Visual C# Visual C++ 2000 Visual C++ http:// homepage3.nifty.com/ishidate/vcpp.htmmicrosoft IDE C++ Visual Studio Express 2012 Visual Studio Express

More information

jquery Hands-On Guide WD jquery Lab. 22 Index 002 006 010 014 018 022 026 030 034 038 042 reveal.js 046 Web jquery 050 Web Designing 2012 12 2014 1 jquery Lab. URL DOWNLOAD ZIP ID IDwdlibjq http://book.mynavi.jp/wd/wdlib/wdlib04/

More information

77 UI JavaScript for Upskilling Index 004 008 012 016 020 024 028 jquery 032 XMLJSON 036 SVGJavaScript 040 044 048 052 Grunt! 056 060 JavaScriptCSS3 Web Designing2014620158JavaScript Lab JavaScript JavaScript+CSS

More information

cpp1.dvi

cpp1.dvi 2017 c 1 C++ (1) C C++, C++, C 11, 12 13 (1) 14 (2) 11 1 n C++ //, [List 11] 1: #include // C 2: 3: int main(void) { 4: std::cout

More information

C言語によるアルゴリズムとデータ構造

C言語によるアルゴリズムとデータ構造 Algorithms and Data Structures in C 4 algorithm List - /* */ #include List - int main(void) { int a, b, c; int max; /* */ Ÿ 3Ÿ 2Ÿ 3 printf(""); printf(""); printf(""); scanf("%d", &a); scanf("%d",

More information

ComputerCraft 対応 寺園聖文 [ 著 ] 中植正剛 [ 監修 ]

ComputerCraft 対応 寺園聖文 [ 著 ] 中植正剛 [ 監修 ] ComputerCraft 対応 寺園聖文 [ 著 ] 中植正剛 [ 監修 ] [ 著者紹介 ] 寺園聖文 ( てらぞのまさふみ ) CoderDojo 西宮 梅田にてメンターをした際 忍者から マインクラフトの Modを作りたい との相談を受けマインクラフトを開始 以来 同ゲームの魅力に取り憑かれ 夜な夜なビルディング Mod 開発に勤しんでいます 現在はキッズプログラミングスクール 8 9 にて指導を行う傍ら

More information

P05.ppt

P05.ppt 2 1 list0415.c forfor #include int i, j; for (i = 1; i

More information

Microsoft PowerPoint - C言語の復習(配布用).ppt [互換モード]

Microsoft PowerPoint - C言語の復習(配布用).ppt [互換モード] if 文 (a と b の大きい方を表示 ) C 言語 Ⅰ の復習 条件判定 (if, 条件式 ) ループ (for[ 二重まで ], while, do) 配列 ( 次元 次元 ) トレース int a, b; printf( 整数 a: ); scanf( %d, &a); printf( 整数 b: ); scanf( %d, &b); //つのif 文で表現する場合間違えやすい どっちに =

More information

r07.dvi

r07.dvi 19 7 ( ) 2019.4.20 1 1.1 (data structure ( (dynamic data structure 1 malloc C free C (garbage collection GC C GC(conservative GC 2 1.2 data next p 3 5 7 9 p 3 5 7 9 p 3 5 7 9 1 1: (single linked list 1

More information

ohp07.dvi

ohp07.dvi 19 7 ( ) 2019.4.20 1 (data structure) ( ) (dynamic data structure) 1 malloc C free 1 (static data structure) 2 (2) C (garbage collection GC) C GC(conservative GC) 2 2 conservative GC 3 data next p 3 5

More information

main

main 14 1. 12 5 main 1.23 3 1.230000 3 1.860867 1 2. 1988 1925 1911 1867 void JPcalendar(int x) 1987 1 64 1 1 1 while(1) Ctrl C void JPcalendar(int x){ if (x > 1988) printf(" %d %d \n", x, x-1988); else if(x

More information

新版明解C言語 実践編

新版明解C言語 実践編 2 List - "max.h" a, b max List - max "max.h" #define max(a, b) ((a) > (b)? (a) : (b)) max List -2 List -2 max #include "max.h" int x, y; printf("x"); printf("y"); scanf("%d", &x); scanf("%d", &y); printf("max(x,

More information

/* do-while */ #include <stdio.h> #include <math.h> int main(void) double val1, val2, arith_mean, geo_mean; printf( \n ); do printf( ); scanf( %lf, &v

/* do-while */ #include <stdio.h> #include <math.h> int main(void) double val1, val2, arith_mean, geo_mean; printf( \n ); do printf( ); scanf( %lf, &v 1 http://www7.bpe.es.osaka-u.ac.jp/~kota/classes/jse.html kota@fbs.osaka-u.ac.jp /* do-while */ #include #include int main(void) double val1, val2, arith_mean, geo_mean; printf( \n );

More information

新・明解C言語で学ぶアルゴリズムとデータ構造

新・明解C言語で学ぶアルゴリズムとデータ構造 第 1 章 基本的 1 n 141 1-1 三値 最大値 algorithm List 1-1 a, b, c max /* */ #include int main(void) { int a, b, c; int max; /* */ List 1-1 printf("\n"); printf("a"); scanf("%d", &a); printf("b"); scanf("%d",

More information

tuat1.dvi

tuat1.dvi ( 1 ) http://ist.ksc.kwansei.ac.jp/ tutimura/ 2012 6 23 ( 1 ) 1 / 58 C ( 1 ) 2 / 58 2008 9 2002 2005 T E X ptetex3, ptexlive pt E X UTF-8 xdvi-jp 3 ( 1 ) 3 / 58 ( 1 ) 4 / 58 C,... ( 1 ) 5 / 58 6/23( )

More information

Taro-再帰関数Ⅲ(公開版).jtd

Taro-再帰関数Ⅲ(公開版).jtd 0. 目次 1 1. ソート 1 1. 1 挿入ソート 1 1. 2 クイックソート 1 1. 3 マージソート - 1 - 1 1. ソート 1 1. 1 挿入ソート 挿入ソートを再帰関数 isort を用いて書く 整列しているデータ (a[1] から a[n-1] まで ) に a[n] を挿入する操作を繰り返す 再帰的定義 isort(a[1],,a[n]) = insert(isort(a[1],,a[n-1]),a[n])

More information

¥×¥í¥°¥é¥ß¥ó¥°±é½¬I Exercise on Programming I [1zh] ` `%%%`#`&12_`__~~~ alse

¥×¥í¥°¥é¥ß¥ó¥°±é½¬I  Exercise on Programming I [1zh] ` `%%%`#`&12_`__~~~alse I Exercise on Programming I http://bit.ly/oitprog1 1, 2 of 14 ( RD S ) I 1, 2 of 14 1 / 44 Ruby Ruby ( RD S ) I 1, 2 of 14 2 / 44 7 5 9 2 9 3 3 2 6 5 1 3 2 5 6 4 7 8 4 5 2 7 9 6 4 7 1 3 ( RD S ) I 1, 2

More information

[1] #include<stdio.h> main() { printf("hello, world."); return 0; } (G1) int long int float ± ±

[1] #include<stdio.h> main() { printf(hello, world.); return 0; } (G1) int long int float ± ± [1] #include printf("hello, world."); (G1) int -32768 32767 long int -2147483648 2147483647 float ±3.4 10 38 ±3.4 10 38 double ±1.7 10 308 ±1.7 10 308 char [2] #include int a, b, c, d,

More information

Microsoft PowerPoint - 説明3_if文switch文(C_guide3)【2015新教材対応確認済み】.pptx

Microsoft PowerPoint - 説明3_if文switch文(C_guide3)【2015新教材対応確認済み】.pptx 情報ネットワーク導入ユニット Ⅰ C 言語 if 文 switch 文 3 章 : プログラムの流れの分岐 if 文 if( 条件 ) 条件が成立すれば実行 if( 条件 ) ~ else 場合分け ( 成立, 不成立 ) if( 条件 A) ~ else if( 条件 B) ~ else if( 条件 C) ~ else 場合分け ( 複数の条件での場合分け ) 等価演算子 : == ( 等しい

More information

@okuraofvegetabl

@okuraofvegetabl @okuraofvegetabl 3 I 5 1?................................. 5 2........................... 6 3,.................................. 6 4................................. 11 II 15 1 Bellman-Ford( )....................

More information

データ構造とアルゴリズム論

データ構造とアルゴリズム論 15 10 7 A[1]A[2] 5 5 A1A2 A5 9 A4 A1 A2 A3 A4 A5 9 A[4] [1] [2] [3] [4] [5] 5 A1A2 A5 A(1)A(5) A1 i 1 A2 A3 i5 Yes No A4 A[i] A5 i+1 13 15 10 7 100 100 Java Java 10 A int A[]; A= new int[10]; int A[] =

More information

@okuraofvegetabl

@okuraofvegetabl @okuraofvegetabl 3 I 5 II 7 1.................................... 7 2............................... 10 3................................... 10 4............................ 21 III 29 1 Propagating tree

More information

2008chom.pdf

2008chom.pdf CHomP Pawe l Pilarczyk 1 CHomP Computational Homology Project [3] OS Windows Mac Unix Linux [3] CHomP [3] 2 3 CHomP CHomP 4 5 C++ [1] 2 CHomP 1 2 K 1 = { A 1 A 2 A 3, A 1 A 2, A 2 A 3, A 1 A 3, A 3 A 4,

More information

program7app.ppt

program7app.ppt プログラム理論と言語第 7 回 ポインタと配列, 高階関数, まとめ 有村博紀 吉岡真治 公開スライド PDF( 情報知識ネットワーク研 HP/ 授業 ) http://www-ikn.ist.hokudai.ac.jp/~arim/pub/proriron/ 本スライドは,2015 北海道大学吉岡真治 プログラム理論と言語, に基づいて, 現著者の承諾のもとに, 改訂者 ( 有村 ) が加筆修正しています.

More information

P06.ppt

P06.ppt p.130 p.198 p.208 2 1 double weight[num]; double min, max; min = max = weight[0]; for( i= 1; i < NUM; i++ ) if ( weight[i] > max ) max = weight[i]: if ( weight[i] < min ) min = weight[i]: weight 3 maxof(a,

More information

C のコード例 (Z80 と同機能 ) int main(void) { int i,sum=0; for (i=1; i<=10; i++) sum=sum + i; printf ("sum=%d n",sum); 2

C のコード例 (Z80 と同機能 ) int main(void) { int i,sum=0; for (i=1; i<=10; i++) sum=sum + i; printf (sum=%d n,sum); 2 アセンブラ (Z80) の例 ORG 100H LD B,10 SUB A LOOP: ADD A,B DEC B JR NZ,LOOP LD (SUM),A HALT ORG 200H SUM: DEFS 1 END 1 C のコード例 (Z80 と同機能 ) int main(void) { int i,sum=0; for (i=1; i

More information

kiso2-09.key

kiso2-09.key 座席指定はありません 計算機基礎実習II 2018 のウェブページか 第9回 ら 以下の課題に自力で取り組んで下さい 計算機基礎実習II 第7回の復習課題(rev07) 第9回の基本課題(base09) 第8回試験の結果 中間試験に関するコメント コンパイルできない不完全なプログラムなど プログラミングに慣れていない あるいは複雑な問題は 要件 をバラして段階的にプログラムを作成する exam08-2.c

More information

PowerPoint Presentation

PowerPoint Presentation p.130 p.198 p.208 2 double weight[num]; double min, max; min = max = weight[0]; for( i= 1; i i < NUM; i++ ) ) if if ( weight[i] > max ) max = weight[i]: if if ( weight[i] < min ) min = weight[i]: weight

More information

Microsoft PowerPoint - lec4.ppt

Microsoft PowerPoint - lec4.ppt 本日の内容 繰り返し計算 while 文, for 文 例題 1. 最大公約数の計算例題 2. 自然数の和 while 文例題 3. フィボナッチ数列例題 4. 自然数の和 for 文例題 5. 九九の表繰り返しの入れ子 今日の到達目標 繰り返し (while 文, for 文 ) を使って, 繰り返し計算を行えるようになること ループカウンタとして, 整数の変数を使うこと 今回も, 見やすいプログラムを書くために,

More information

8 if switch for while do while 2

8 if switch for while do while 2 (Basic Theory of Information Processing) ( ) if for while break continue 1 8 if switch for while do while 2 8.1 if (p.52) 8.1.1 if 1 if ( ) 2; 3 1 true 2 3 false 2 3 3 8.1.2 if-else (p.54) if ( ) 1; else

More information

CONTENTS MacBook 2014 OS X Mavericks Chapter Chapter

CONTENTS MacBook 2014 OS X Mavericks Chapter Chapter CONTENTS MacBook 2014 OS X Mavericks Chapter 1 008 010 012 016 018 026 028 032 034 Chapter 2 038 040 044 046 048 050 052 054 056 058 062 064 066 070 072 074 080 082 084 086 088 093 094 098 100 102 Chapter

More information

C o n t e n t s Pages Numbers Keynote E Chapter 1 Pages Numbers Keynote 12 14 16 18 20 22 E Chapter 2 Pages 24 26 28 30 32 34 36 38 40 004 42 44 48 50 52 54 56 58 60 62 64 66 68 70 72 74 76 78 80 82 84

More information

C o n t e n t s Office 2016 for Mac 3 Chapter 1 Office 2016 12 14 16 18 20 22 24 28 30 Chapter 2 32 34 36 38 40 42 44 46 48 50 52 54 56 58 60 62 64 66 68 70 72 74 76 78 80 82 86 88 90 92 94 96 98 100 102

More information

P03.ppt

P03.ppt (2) Switch case 5 1 1 2 1 list0317.c if /*/ intnum; printf(""); scanf("%d", &num); 2 if (num % 3 == 0) puts( 0"); else if (num % 3 == 1) puts(" 1"); else puts( 32"); 3 if list0318.c /*/ intnum; printf("");

More information

C o n t e n t s Introduction 12 14 18 22 E Chapter 1 26 28 30 32 34 36 38 40 42 iphoto A 44 46 48 50 52 54 56 58 60 64 68 72 74 76 80 86 90 94 98 100 A A A A A 102 104 E Chapter 2 112 114 116 120 122 124

More information

1.ppt

1.ppt /* * Program name: hello.c */ #include int main() { printf( hello, world\n ); return 0; /* * Program name: Hello.java */ import java.io.*; class Hello { public static void main(string[] arg)

More information

C , C++ C C++ C++ C cpprefjp - C++ 1 C CUI 2.1 donothing.cpp 1

C , C++ C C++ C++ C cpprefjp - C++ 1 C CUI 2.1 donothing.cpp 1 C++ 2018 7 1, 2018 11 4 http://nalab.mind.meiji.ac.jp/~mk/labo/text/nantoka-c++/ 1 C++ C C++ C++ C cpprefjp - C++ 1 C++17 2 2 CUI 2.1 donothing.cpp 1 /* 2 * donothing.cpp 3 */ 4 5 int main() 6 7 return

More information

2

2 問題 次の設問に答えよ 設問. Java のソースコードをコンパイルするコマンドはどれか a) java b) javac c) javadoc d) javaw 設問. Java のバイトコード ( コンパイル結果 ) を実行するコマンドはどれか a) java b) javac c) javadoc d).jar 設問. Java のソースコードの拡張子はどれか a).c b).java c).class

More information

Microsoft PowerPoint - 10.ppt [互換モード]

Microsoft PowerPoint - 10.ppt [互換モード] 第 10 回関数と再帰 1 今回の目標 再帰的な考え方に慣れる C 言語における再帰関数を理解する 階乗を求める再帰的な関数を作成し その関数を利用するプログラムを作成する 2 階乗 n! の 2 つの数学的表現 (1) 繰り返しによる表現 n! = 1 2 i n n = ii i= 1 ( n 1 のとき ) ( なお 0!=1) (2) 漸化式による表現 n! = 1 n = 0のとき n (

More information

cpp2.dvi

cpp2.dvi 2018 c 2 C++ (2) STL, C++ 21 string 22 STL 23 21 string C, \0, (, ), (, ), /,,,, C++,,, string string,,,,,, include,,, int, > >>,,,, getline(, string ), [List 21] 2: #include 3: 4:

More information

ohp11.dvi

ohp11.dvi 19 11 ( ) 2019.4.20 1 / ( ) n O(n 2 ) O(n 2 ) ( ) 1 d n 1 n logn O(nlogn) n ( n logn C ) 2 ( ) ( merge) 2 1 1 3 1 4 5 4 2 3 7 9 7 1 2 3 4 5 7 9 1: 2 ivec merge 3 ( ) (2) int *ivec_new(int size) { int *a

More information

r11.dvi

r11.dvi 19 11 ( ) 2019.4.20 1 / 1.1 ( n n O(n 2 O(n 2 ) ( 1 d n 1 n logn O(nlogn n ( n logn C 1.2 ( ( merge 2 1 1 3 1 4 5 4 2 3 7 9 7 1 2 3 4 5 7 9 1: 2 ivec merge int *ivec_new(int size) { int *a = (int*)malloc((size+1)

More information

double float

double float 2015 3 13 1 2 2 3 2.1.......................... 3 2.2............................. 3 3 4 3.1............................... 4 3.2 double float......................... 5 3.3 main.......................

More information

cp-7. 配列

cp-7. 配列 cp-7. 配列 (C プログラムの書き方を, パソコン演習で学ぶシリーズ ) https://www.kkaneko.jp/cc/adp/index.html 金子邦彦 1 本日の内容 例題 1. 月の日数配列とは. 配列の宣言. 配列の添え字. 例題 2. ベクトルの内積例題 3. 合計点と平均点例題 4. 棒グラフを描く配列と繰り返し計算の関係例題 5. 行列の和 2 次元配列 2 今日の到達目標

More information

3.1 stdio.h iostream List.2 using namespace std C printf ( ) %d %f %s %d C++ cout cout List.2 Hello World! cout << float a = 1.2f; int b = 3; cout <<

3.1 stdio.h iostream List.2 using namespace std C printf ( ) %d %f %s %d C++ cout cout List.2 Hello World! cout << float a = 1.2f; int b = 3; cout << C++ C C++ 1 C++ C++ C C++ C C++? C C++ C *.c *.cpp C cpp VC C++ 2 C++ C++ C++ [1], C++,,1999 [2],,,2001 [3], ( )( ),,2001 [4] B.W. /D.M.,, C,,1989 C Web [5], http://kumei.ne.jp/c_lang/ 3 Hello World Hello

More information

プログラミングA

プログラミングA プログラミング A 第 5 回 場合に応じた処理 繰り返し 2019 年 5 月 13 日 東邦大学金岡晃 場合に応じた処理 1 こういうプログラムを作りたい 5 教科のテスト 100 点以上各科目の点数の合計が 100 点未満 おめでとう! これで 100 点越えのプレゼントを獲得! というメッセージを出力 残念!100 点越えのプレゼントまであと ** 点! というメッセージを出力 5 教科の点数の合計が

More information

‚æ4›ñ

‚æ4›ñ ( ) ( ) ( ) A B C D E F G H I J K L M N O P Q R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z 0 1 2 3 4 5 6 7 8 9 (OUS) 9 26 1 / 28 ( ) ( ) ( ) A B C D Z a b c d z 0 1 2 9 (OUS) 9

More information

プログラミング入門1

プログラミング入門1 プログラミング入門 1 第 9 回 メソッド (3) 授業の前に自己点検 以下の質問に答えられますか? メソッドの宣言とは 起動とは何ですか メソッドの宣言はどのように書きますか メソッドの宣言はどこに置きますか メソッドの起動はどのようにしますか メソッドの仮引数 実引数 戻り値とは何ですか メソッドの起動にあたって実引数はどのようにして仮引数に渡されますか 戻り値はどのように利用しますか 変数のスコープとは何ですか

More information

新・明解C言語 実践編

新・明解C言語 実践編 第 1 章 見 21 1-1 見えないエラー 見 List 1-1 "max2x1.h" a, b max2 List 1-1 chap01/max2x1.h max2 "max2x1.h" #define max2(a, b) ((a) > (b)? (a) : (b)) max2 List 1-2 List 1-2 chap01/max2x1test.c max2 #include

More information

PC Windows 95, Windows 98, Windows NT, Windows 2000, MS-DOS, UNIX CPU

PC Windows 95, Windows 98, Windows NT, Windows 2000, MS-DOS, UNIX CPU 1. 1.1. 1.2. 1 PC Windows 95, Windows 98, Windows NT, Windows 2000, MS-DOS, UNIX CPU 2. 2.1. 2 1 2 C a b N: PC BC c 3C ac b 3 4 a F7 b Y c 6 5 a ctrl+f5) 4 2.2. main 2.3. main 2.4. 3 4 5 6 7 printf printf

More information

(search: ) [1] ( ) 2 (linear search) (sequential search) 1

(search: ) [1] ( ) 2 (linear search) (sequential search) 1 2005 11 14 1 1.1 2 1.2 (search:) [1] () 2 (linear search) (sequential search) 1 2.1 2.1.1 List 2-1(p.37) 1 1 13 n

More information

3 Java 3.1 Hello World! Hello World public class HelloWorld { public static void main(string[] args) { System.out.println("Hello World");

3 Java 3.1 Hello World! Hello World public class HelloWorld { public static void main(string[] args) { System.out.println(Hello World); (Basic Theory of Information Processing) Java (eclipse ) Hello World! eclipse Java 1 3 Java 3.1 Hello World! Hello World public class HelloWorld { public static void main(string[] args) { System.out.println("Hello

More information

O(N) ( ) log 2 N

O(N) ( ) log 2 N 2005 11 21 1 1.1 2 O(N) () log 2 N 1.2 2 1 List 3-1 List 3-3 List 3-4? 3 3.1 3.1.1 List 2-1(p.70) 1 1 10 1 3.1.2 List 3-1(p.70-71) 1 1 2 1 2 2 1: 1 3 3.1.3 1 List 3-1(p.70-71) 2 #include stdlib.h

More information

Microsoft Word - no14.docx

Microsoft Word - no14.docx ex26.c #define MAX 20 int max(int n, int x[]); int num[max]; int i, x; printf(" "); scanf("%d", &x); if(x > MAX) printf("%d %d \n", MAX, MAX); x = MAX; for(i = 0; i < x; i++) printf("%3d : ", i + 1); scanf("%d",

More information

プログラミングA

プログラミングA プログラミング A 第 5 回 場合に応じた処理 繰り返し 2017 年 5 月 15 日 東邦大学金岡晃 前回の復習 (1) このプログラムを作成し実行してください 1 前回の復習 (2) このプログラムを作成し実行してください 2 前回の復習 (3) 3 前回の復習 演算子 代入演算子 インクリメント シフト演算子 型変換 4 場合に応じた処理 5 こういうプログラムを作りたい 5 教科のテスト

More information

For Beginner P.139 P.140 P.141 P.142 P.143 P.151 P.152 P.162 P.163 P.164 P.184 P.184 For Middle P.184 P.184 P.144 P.153 For Middle P.154 P.144 P.155 P153 004 For Beginner 89 1 2 CHAPTER 3 3 4 POINT 005

More information

問題 01 水道料金を節約しよう 問題のポイント問題文で述べられた仕様を理解し その通りに動作するプログラムを記述できるかを問う問題です 変数 入出力 四則演算に加え 条件分岐や繰り返し処理についての知識が必要です 問題の解き方いくつかのアルゴリズムが考えられますが w が 100 以下と小さい値な

問題 01 水道料金を節約しよう 問題のポイント問題文で述べられた仕様を理解し その通りに動作するプログラムを記述できるかを問う問題です 変数 入出力 四則演算に加え 条件分岐や繰り返し処理についての知識が必要です 問題の解き方いくつかのアルゴリズムが考えられますが w が 100 以下と小さい値な 問題 01 水道料金を節約しよう 問題のポイント問題文で述べられた仕様を理解し その通りに動作するプログラムを記述できるかを問う問題です 変数 入出力 四則演算に加え 条件分岐や繰り返し処理についての知識が必要です 問題の解き方いくつかのアルゴリズムが考えられますが w が 100 以下と小さい値なので 水量を 1m 3 ずつ増やして料金を加算していく簡単なアルゴリズムでも大丈夫です 具体的には 使用水量

More information

Microsoft Word - Cプログラミング演習(1)_2012

Microsoft Word - Cプログラミング演習(1)_2012 第 1 回 (4/16) 参考書 : [1] B.W. カーニハン,D.M. リッチー著 : プログラミング言語 C 第 2 版 ANSI 規格準拠, 共立出版, 1989 年. [2] 高橋麻奈著 : やさしい C 第 2 版, ソフトバンククリエイティブ, 2003 年. [3] 柴田望洋著 : 新版明解 C 言語入門編, ソフトバンククリエイティブ, 2004 年. [4] 林晴比古著 : 新

More information

Excel97関数編

Excel97関数編 Excel97 SUM Microsoft Excel 97... 1... 1... 1... 2... 3... 3... 4... 5... 6... 6... 7 SUM... 8... 11 Microsoft Excel 97 AVERAGE MIN MAX SUM IF 2 RANK TODAY ROUND COUNT INT VLOOKUP 1/15 Excel A B C A B

More information

PowerPoint プレゼンテーション

PowerPoint プレゼンテーション プログラミング応用演習 第 4 回再帰的構造体 プログラミングを 余談 : 教えることの難しさ 丁寧に説明しないと分かってもらえない 説明すると 小難しくなる学生が目指すべきところプログラム例を説明されて理解できる違うやり方でも良いので自力で解決できる おっけー 動けば良い という意識でプログラミング 正しく動くことのチェックは必要 解答例と自分のやり方との比較が勉強になる 今日のお題 再帰的構造体

More information

135 116 Column 1 5 3 8 7 POINT 6 4 2 Excel& 2013&2010&2007 C O N T E N T S Chapter 1 Q001 Q002 Q003 Q004 Q005 Q006 Q007 Q008 Q009 Q010 Q011 Q012 Q013 Q014 Q015 Chapter 2 Q016 Q017 Q018 Q019 Q020 Q021 Q022

More information

10K

10K 1 2 3 4 Object Oriented Object Oriented Programming(OOP) 5 6 OOP#1 OOP#2 Java 7 Java 8 手続き型 v.s. OOP #1 OOPのメリット#3 追加 変更がラク 出典 立山秀利 Javaのオブジェクト指向がゼッタイにわかる本 秀和システム 出典 立山秀利 Javaのオブジェクト指向がゼッタイにわかる本 秀和システム

More information

( ) ( ) 30 ( ) 27 [1] p LIFO(last in first out, ) (push) (pup) 1

( ) ( ) 30 ( ) 27 [1] p LIFO(last in first out, ) (push) (pup) 1 () 2006 2 27 1 10 23 () 30 () 27 [1] p.97252 7 2 2.1 2.1.1 1 LIFO(last in first out, ) (push) (pup) 1 1: 2.1.2 1 List 4-1(p.100) stack[] stack top 1 2 (push) (pop) 1 2 void stack push(double val) val stack

More information

プログラミング基礎

プログラミング基礎 C プログラミング Ⅰ 条件分岐 : if 文, if~else 文 条件分岐 条件分岐とは ある条件が成立したときとしないときで処理の内容を変更する場合に応じた, 複雑な処理を行うことができる 条件分岐 yes 成績が良かったか? no ご褒美に何か買ってもらう お小遣いが減らされる C 言語では,if 文,if~else 文,if~else if~else 文,switch 文で条件分岐の処理を実現できる

More information

発行元 株式会社マイナビ 東京都千代田区一ツ橋1-1-1 パレスサイドビル 編集 販売 注文専用ダイヤル マイナビ 2014 Printed in Japan 図書印刷 株 雑誌

発行元 株式会社マイナビ 東京都千代田区一ツ橋1-1-1 パレスサイドビル 編集 販売 注文専用ダイヤル マイナビ 2014 Printed in Japan 図書印刷 株 雑誌 発行元 株式会社マイナビ 100-0003 東京都千代田区一ツ橋1-1-1 パレスサイドビル 編集 03-6267-4433 販売 03-6267-4477 注文専用ダイヤル 048-485-2383 マイナビ 2014 Printed in Japan 図書印刷 株 雑誌 68400-25 ipad Air & ipad mini C O N T E N T S Chapter 1 ipad Air

More information

次に示す数値の並びを昇順にソートするものとする このソートでは配列の末尾側から操作を行っていく まず 末尾の数値 9 と 8 に着目する 昇順にソートするので この値を交換すると以下の数値の並びになる 次に末尾側から 2 番目と 3 番目の 1

次に示す数値の並びを昇順にソートするものとする このソートでは配列の末尾側から操作を行っていく まず 末尾の数値 9 と 8 に着目する 昇順にソートするので この値を交換すると以下の数値の並びになる 次に末尾側から 2 番目と 3 番目の 1 4. ソート ( 教科書 p.205-p.273) 整列すなわちソートは アプリケーションを作成する際には良く使われる基本的な操作であり 今までに数多くのソートのアルゴリズムが考えられてきた 今回はこれらソートのアルゴリズムについて学習していく ソートとはソートとは与えられたデータの集合をキーとなる項目の値の大小関係に基づき 一定の順序で並べ替える操作である ソートには図 1 に示すように キーの値の小さいデータを先頭に並べる

More information

Microsoft Word - no11.docx

Microsoft Word - no11.docx 3. 関数 3.1 関数関数は数学の関数と同じようなイメージを持つと良いでしょう 例えば三角関数の様に一つの実数値 ( 角度 ) から値を求めますし 対数関数の様に二つの値から一つの値を出すものもあるでしょう これをイメージしてもらえば結構です つまり 何らかの値を渡し それをもとに何かの作業や計算を行い その結果を返すのが関数です C 言語の関数も基本は同じです 0 cos 1 cos(0) =

More information

Java updated

Java updated Java 2003.07.14 updated 3 1 Java 5 1.1 Java................................. 5 1.2 Java..................................... 5 1.3 Java................................ 6 1.3.1 Java.......................

More information

pptx

pptx iphone 2010 8 18 C xkozima@myu.ac.jp C Hello, World! Hello World hello.c! printf( Hello, World!\n );! os> ls! hello.c! os> cc hello.c o hello! os> ls! hello!!hello.c! os>./hello! Hello, World!! os>! os>

More information

I ASCII ( ) NUL 16 DLE SP P p 1 SOH 17 DC1! 1 A Q a q STX 2 18 DC2 " 2 B R b

I ASCII ( ) NUL 16 DLE SP P p 1 SOH 17 DC1! 1 A Q a q STX 2 18 DC2  2 B R b I 4 003 4 30 1 ASCII ( ) 0 17 0 NUL 16 DLE SP 0 @ P 3 48 64 80 96 11 p 1 SOH 17 DC1! 1 A Q a 33 49 65 81 97 113 q STX 18 DC " B R b 34 50 66 8 98 114 r 3 ETX 19 DC3 # 3 C S c 35 51 67 83 99 115 s 4 EOT

More information

解きながら学ぶC++入門編

解きながら学ぶC++入門編 !... 38!=... 35 "... 112 " "... 311 " "... 4, 264 #... 371 #define... 126, 371 #endif... 369 #if... 369 #ifndef... 369 #include... 3, 311 #undef... 371 %... 17, 18 %=... 85 &... 222 &... 203 &&... 40 &=...

More information

明解Javaによるアルゴリズムとデータ構造

明解Javaによるアルゴリズムとデータ構造 74 searching 3 key Fig.3-1 75 2を探索 53を探索 3-1 5 2 1 4 3 7 4 を探索 Fig.3-1 76 3 linear searchsequential search 2 Fig.3-2 0 ❶ ❷ ❸ 配列の要素を先頭から順に走査していく 探索すべき値と等しい要素を発見 Fig.3-2 6 4 3 2 3-2Fig.3-3 77 5 Fig.3-3 0

More information

untitled

untitled C++2 1. publicprivate 2. 3. 4. 5. Intelligent Electronic Systems Group protected Carmainmy_car.car_number ca_number //Car class Car int car_number; // void showgas( ); // double gas; // void shownumber(

More information

PowerPoint プレゼンテーション

PowerPoint プレゼンテーション プログラミング応用演習 第 4 回再帰的構造体 前回の出席確認演習 #include int main() { FILE *fp; int c, linecount, length, maxlength; fp=fopen("/usr/share/dict/words","r"); if (fp == NULL) return 1; linecount=0; length=0;

More information

2

2 問題 1 次の設問 1~5 に答えよ 設問 1. Java のソースプログラムをコンパイルするコマンドはどれか a) java b) javac c) javadoc d) jdb 設問 2. Java のバイトコード ( コンパイル結果 ) を実行するコマンドはどれか a) java b) javac c) javadoc d) jdb 設問 3. Java のソースプログラムの拡張子はどれか a).c

More information

平成 29 年度卒業研究 初心者のためのゲームプログラミング用 教材の開発 函館工業高等専門学校生産システム工学科情報コース 5 年 25 番細見政央指導教員東海林智也

平成 29 年度卒業研究 初心者のためのゲームプログラミング用 教材の開発 函館工業高等専門学校生産システム工学科情報コース 5 年 25 番細見政央指導教員東海林智也 平成 29 年度卒業研究 初心者のためのゲームプログラミング用 教材の開発 函館工業高等専門学校生産システム工学科情報コース 5 年 25 番細見政央指導教員東海林智也 目次 第 1 章英文アブストラクト第 2 章研究目的第 3 章研究背景第 4 章開発環境第 5 章開発した 2D ゲーム制作ライブラリの概要第 6 章ライブラリの使用方法第 7 章まとめと今後の課題参考文献 1 第 1 章英文アブストラクト

More information

1.3 ( ) ( ) C

1.3 ( ) ( ) C 1 1.1 (Data Base) (Container) C++ Java 1.2 1 1.3 ( ) ( ) 1. 2. 3. C++ 2 2.1 2.2 2.3 2 C Fortran C++ Java 3 3.1 (Vector) 1. 2. ( ) 3.2 3 3.3 C++ C++ STL C++ (Template) vector vector< > ; int arrayint vector

More information

C¥×¥í¥°¥é¥ß¥ó¥° ÆþÌç

C¥×¥í¥°¥é¥ß¥ó¥° ÆþÌç C (3) if else switch AND && OR (NOT)! 1 BMI BMI BMI = 10 4 [kg]) ( [cm]) 2 bmi1.c Input your height[cm]: 173.2 Enter Input your weight[kg]: 60.3 Enter Your BMI is 20.1. 10 4 = 10000.0 1 BMI BMI BMI = 10

More information

データ構造とアルゴリズム論

データ構造とアルゴリズム論 15 12 2 (n-1)(n-2) n Fact(n) factorial Fact Fact(n) X XX*i X1 i:1,1,n Fact(n) AnsFact(n) Ans 123 15 12 2 6-8 void jbuttonkeisan actionperformed(actionevent e) { int Ans,n; n=integer.parseint(jtextfieldn.gettext())

More information

MacOSX印刷ガイド

MacOSX印刷ガイド 3 CHAPTER 3-1 3-2 3-3 1 2 3 3-4 4 5 6 3-5 1 2 3 4 3-6 5 6 3-7 7 8 3-8 1 2 3 4 3-9 5 6 3-10 7 1 2 3 4 3-11 5 6 3-12 7 8 9 3-13 10 3-14 1 2 3-15 3 4 1 2 3-16 3 4 5 3-17 1 2 3 4 3-18 1 2 3 4 3-19 5 6 7 8

More information

荳也阜轣ス螳ウ蝣ア蜻・indd

荳也阜轣ス螳ウ蝣ア蜻・indd 1 2 3 CHAPTER 1 4 CHAPTER 1 5 6CHAPTER 1 CHAPTER 1 7 8CHAPTER 1 CHAPTER 2 9 10CHAPTER 2 CHAPTER 2 11 12 CHAPTER 2 13 14CHAPTER 3 CHAPTER 3 15 16CHAPTER 3 CHAPTER 3 17 18 CHAPTER 4 19 20CHAPTER 4 CHAPTER

More information

2) TA Hercules CAA 5 [6], [7] CAA BOSS [8] 2. C II C. ( 1 ) C. ( 2 ). ( 3 ) 100. ( 4 ) () HTML NFS Hercules ( )

2) TA Hercules CAA 5 [6], [7] CAA BOSS [8] 2. C II C. ( 1 ) C. ( 2 ). ( 3 ) 100. ( 4 ) () HTML NFS Hercules ( ) 1,a) 2 4 WC C WC C Grading Student programs for visualizing progress in classroom Naito Hiroshi 1,a) Saito Takashi 2 Abstract: To grade student programs in Computer-Aided Assessment system, we propose

More information

プログラミング入門1

プログラミング入門1 プログラミング入門 1 第 8 回メソッド (2) 授業開始前に自己点検 前回までの必須課題はすべてできていますか 前回までの学習項目であいまいな所はありませんか 理解できたかどうかは自分自身の基準をもとう Java 1 第 8 回 2 前回のテーマ メソッドとは いくつかの命令の列を束ねて 一つの命令として扱えるようにしたもの 今回学ぶメソッドの役割は その他のプログラミング言語では関数またはサブルーチンと呼ばれることがある

More information

(STL) STL 1 (deta structure) (algorithm) (deta structure) 2 STL STL (Standard Template Library) 2.1 STL STL ( ) vector<int> x; for(int i = 0; i < 10;

(STL) STL 1 (deta structure) (algorithm) (deta structure) 2 STL STL (Standard Template Library) 2.1 STL STL ( ) vector<int> x; for(int i = 0; i < 10; (STL) STL 1 (deta structure) (algorithm) (deta structure) 2 STL STL (Standard Template Library) 2.1 STL STL ( ) vector x; for(int i = 0; i < 10; ++i) x.push_back(i); vector STL x.push_back(i) STL

More information

Taro-再帰関数Ⅱ(公開版).jtd

Taro-再帰関数Ⅱ(公開版).jtd 0. 目次 6. 2 項係数 7. 二分探索 8. 最大値探索 9. 集合 {1,2,,n} 上の部分集合生成 - 1 - 6. 2 項係数 再帰的定義 2 項係数 c(n,r) は つぎのように 定義される c(n,r) = c(n-1,r) + c(n-1,r-1) (n 2,1 r n-1) = 1 (n 0, r=0 ) = 1 (n 1, r=n ) c(n,r) 0 1 2 3 4 5

More information

81 /******************************************************************************/ 82 /* スレーブアドレスの設定 */ 83 /*****************************************

81 /******************************************************************************/ 82 /* スレーブアドレスの設定 */ 83 /***************************************** 1 /******************************************************************************/ 2 /* IIC(Inter IC Bus) の制御 */ 3 /******************************************************************************/ 4 /*

More information

Javaによるアルゴリズムとデータ構造

Javaによるアルゴリズムとデータ構造 1 algorithm List 1-1 a, b, c List 1-1 // import java.util.scanner; class Max3 { public static void main(string[] args) { Scanner stdin = new Scanner(System.in); int a, b, c; int max; // Chap01/Max3.java

More information

89 91 93 95 97 99 101 103 105 107 109 111 113 115 H 117 119 l l 121 l l 123 125 127 129 l l l l 131 kl kl kl kl 133 135 137 139 141 143 145 147 149 151 153 155 157 159

More information

株式会社日清製粉グループ本社 第158期中間事業報告書

株式会社日清製粉グループ本社 第158期中間事業報告書 C O N T E N T S...1...3...5...7...9...11...12...13...14 1 2 3 4 3.7% 5.8% 8.5% 70,100kL 81.2% 0.8% 25 20 15 10 5 0 9.18 9.54 9.74 9.62 9.65 9.71 21.04 21.97 22.44 22.23 8.54 22.31 22.45 20.41 15 12 9 6

More information

Microsoft Word - C言語研修 C++編 3.doc

Microsoft Word - C言語研修 C++編 3.doc 2006/05/10 オブジェクト指向... 3 1 クラスの継承... 3 2 継承の書式... 3 3 protected... 5 4 メンバ関数のオーバーライド... 6 5 クラスの型キャスト... 7 6 仮想関数... 8 2 オブジェクト指向 1 クラスの継承 クラスには 継承 という機能があります 継承とは 既にあるクラスを元に 新しいクラスを作る 機能です 継承元のクラスを 親クラス

More information

P KK-KKH.indd

P KK-KKH.indd S / Series Series 3.882 Series 3.882 RoS KQ2 KQB2 KS KX K KF /DL L/LL KC 130 D KD KB KR KA KQG2 346 Series KG Series Series KFG2 S A KP LQ QR IDK 213 Series 3 4 6 3 4 6 Series 3 4 Rc1/8 Rc1/4 Rc3/8 P.215~223

More information

PG13-6S

PG13-6S プログラム演習 I レポート 学籍番号 担当教員 : 小林郁夫 氏名 実習日平成 26 年 7 月 4 日 提出期限 7 月 11 日提出日 7 月 17 日 1 週遅れ 第 13 回 テーマ : 並べ替えのアルゴリズム 教員使用欄 15 S A B C 再提出 課題 1 バブルソートの実行画面 プログラムのソースコード // day13_akb1.cpp : コンソールアプリケーションのエントリポイントを定義します

More information