いろんな言語で宿題スレ
at TECH
120:デフォルトの名無しさん
09/06/09 13:32:07
>>112 6、
% Prolog
t112_6(X) :- get_integer(N),t112_6(N,[N],X).
t112_6(N,L,N) :- count(N,L,3).
t112_6(N,L,X) :- get_integer(M),t112_6(M,[M|L],X).
count(A,[],0).
count(A,[A|R],X) :- count(A,R,Y),X is Y+1.
count(A,[_|R],X) :- count(A,R,X).
get_integer(N) :- repeat,write('整数(0-9).改行 ? '),read(N),N>=0,N=<9,!.
次ページ続きを表示1を表示最新レス表示スレッドの検索類似スレ一覧話題のニュースおまかせリスト▼オプションを表示暇つぶし2ch
4630日前に更新/314 KB
担当:undef