Skip to content

Instantly share code, notes, and snippets.

@maehrm
maehrm / h20h_fe_pm10.c
Created Mar 24, 2019
平成20年度春期試験_基本情報午後問10
View h20h_fe_pm10.c
#include <stdio.h>
#include <ctype.h>
void tofraction(char *);
long power10(int);
long gcd(long, long);
void tofraction(char *str) {
long numerator = 0; /* 分子 */
long denominator; /* 分母 */
@maehrm
maehrm / h20h_fe_pm6.rb
Created Mar 24, 2019
平成20年度春期試験_基本情報午後問6(Ruby)
View h20h_fe_pm6.rb
def markup_reference in_filename, out_filename
ref_name_tbl = []
File.open(in_filename, "r") do |ifp|
File.open(out_filename, "w") do |ofp|
str = ifp.read
str.scan(/(.*?)\\(.+?)\\/) {|pre, ref_name|
ofp.print pre
if i = ref_name_tbl.index(ref_name)
ofp.print "[#{i + 1}]"
else
@maehrm
maehrm / h20h_fe_pm6.c
Created Mar 24, 2019
平成20年度春期試験_基本情報午後問6(C)
View h20h_fe_pm6.c
#include <stdio.h>
#include <string.h>
#define MRNUM 50 /* 参考資料名の最大個数 */
#define MRLNG 255 /* 参考資料名の最大文字数 */
#define MARK '\\' /* 参考資料名の囲み文字 */
void markup_reference(const char *, const char *);
void markup_reference(const char *in_filename,
@maehrm
maehrm / h20h_fe_pm4.c
Created Mar 23, 2019
平成20年度春期試験_基本情報午後問4
View h20h_fe_pm4.c
#include <stdio.h>
#include <string.h>
typedef struct {
int next;
char value[4];
} LIST;
LIST list[100];
int listsize = 0, first = -1;
@maehrm
maehrm / h20h_fe_pm2.c
Last active Mar 22, 2019
平成20年度春期試験_基本情報午後問2
View h20h_fe_pm2.c
#include <stdio.h>
#include <string.h>
#define TRUE (1)
#define FALSE (0)
int matchCounter(char [], int , char [], int );
int matchCounter(char sourceText[], int textlen, char pattern[], int patlen) {
int counter, i, j, k;
@maehrm
maehrm / h20a_fe_pm10.c
Created Mar 21, 2019
平成20年度秋期試験_基本情報午後問10
View h20a_fe_pm10.c
#include <stdio.h>
#define ROWS 4 /* 換字表の行数 */
#define COLS 23 /* 換字表の列数 */
void encrypt_text(const char *, const char *,
const char[ROWS][COLS]);
void decrypt_text(const char *, const char *,
const char[ROWS][COLS]);
void make_ctbl(char [ROWS][COLS]);
@maehrm
maehrm / h20a_fe_pm6.c
Created Mar 18, 2019
平成20年度秋期試験_基本情報午後問6
View h20a_fe_pm6.c
#include <stdio.h>
void convert(long, char []);
void convert(long num, char str[]) {
int minus = 0, i = 0, j = 0;
char table[] = "0123456789";
char tmp;
if (num < 0) {
@maehrm
maehrm / h28a_fe_pm8.c
Created Mar 17, 2019
平成28年度秋季試験_基本情報午後問8
View h28a_fe_pm8.c
#include <stdio.h>
#include <string.h>
#define ON (1)
#define OFF (0)
void edit(char [], char []);
void edit(char pattern[], char value[]) {
char fill;
int signif;
@maehrm
maehrm / h28a_fe_pm9.c
Created Mar 16, 2019
平成28年度秋季試験_基本情報午後問9
View h28a_fe_pm9.c
#include <stdio.h>
typedef struct {
char pr_code[9]; /* 開発コード */
int job_term; /* 開発作業日数 */
int target_term; /* 目標作業期間 */
} JOB;
void job_scheduling(int, JOB[], int[]);
void print_schedule(int, JOB[], int[]);
@maehrm
maehrm / h29a_fe_pm8.c
Last active Mar 15, 2019
平成29年度秋季試験_基本情報午後問8
View h29a_fe_pm8.c
#include <stdio.h>
#include <string.h>
#define N 30
const char tbl[N + 1] = " .,?abcdefghijklmnopqrstuvwxyz";
int getValue(char);
char getChar(int);
char calcCheckCharacter(char [], int);
int validateCheckCharacter(char [], int);
You can’t perform that action at this time.